public Expression(string expression, ExpressionContext context, bool isGeneric) { Utility.AssertNotNull(expression, "expression"); _myExpression = expression; _myOwner = context.ExpressionOwner; _myContext = context; if (context.NoClone == false) { _myContext = context.CloneInternal(false); } _myInfo = new ExpressionInfo(); this.SetupOptions(_myContext.Options, isGeneric); _myContext.Imports.ImportOwner(_myOptions.OwnerType); this.ValidateOwner(_myOwner); this.Compile(expression, _myOptions); _myContext.CalculationEngine?.FixTemporaryHead(this, _myContext, _myOptions.ResultType); }
public IExpression Clone() { Expression <T> copy = (Expression <T>) this.MemberwiseClone(); copy._myContext = _myContext.CloneInternal(true); copy._myOptions = copy._myContext.Options; return(copy); }
private ExpressionContext ParseAndLink(string expressionName, string expression) { IdentifierAnalyzer analyzer = Context.ParseIdentifiers(expression); ExpressionContext context2 = _myContext.CloneInternal(true); this.LinkExpression(expressionName, context2, analyzer); // Tell the expression not to clone the context since it's already been cloned context2.NoClone = true; // Clear our context's variables _myContext.Variables.Clear(); return(context2); }