public override IExpr Patch(Patch substitutions) { XSlice result; if (substitutions.TryGetValue(this, out result)) { return(result); } var inputsPatched = Inputs.Patch(substitutions); if (inputsPatched != Inputs) { XSlice patched; if (IsSingleton) { patched = new XSlice((Scalar <int>)inputsPatched[0]); } else { patched = new XSlice((Scalar <int>)inputsPatched[0], (Scalar <int>)inputsPatched[1], (Scalar <int>)inputsPatched[2]); } substitutions.Add(this, patched); return(patched); } else { return(this); } }
public override sealed IExpr Patch(Patch substitutions) { Tuple2 result; if (substitutions.TryGetValue(this, out result)) { return(result); } var patchInputs = Inputs.Patch(substitutions); if (patchInputs == Inputs) { return(this); } result = Clone(patchInputs); substitutions.Add(this, result); return(result); }