protected override Expression RewriteSet(AssignmentExtensionExpression node) { GlobalVariableExpression lvalue = (GlobalVariableExpression)node.Expression; return AstUtils.Convert( Expression.Assign( MapToExpression(lvalue), AstUtils.Convert(Visit(node.Value), typeof(object)) ), node.Type ); }
protected override Expression RewriteSet(AssignmentExtensionExpression node) { GlobalVariableExpression lvalue = (GlobalVariableExpression)node.Expression; EnsureUniqueName(lvalue); return AstUtils.Convert( Expression.Call( typeof(ScriptingRuntimeHelpers).GetMethod(lvalue.IsLocal ? "SetName" : "SetGlobalName"), new Expression[]{ Context, AstUtils.Constant(SymbolTable.StringToId(lvalue.Name)), Visit(node.Value) } ), node.Type ); }
protected abstract Expression RewriteSet(AssignmentExtensionExpression node);
private Expression Rewrite(AssignmentExtensionExpression node) { Expression lvalue = node.Expression; GlobalVariableExpression global = lvalue as GlobalVariableExpression; if (global != null) { return RewriteSet(node); } return node; }
private Expression RewriteSet(AssignmentExtensionExpression node) { var value = Visit(node.Value); var globalVar = (GlobalVariableExpression)node.Expression; if (_wrappers == null) { return new SetNameExpression(globalVar.IsLocal, SymbolTable.StringToId(globalVar.Name), Context, value); } else { return new GlobalSetExpression(GetWrapper(globalVar), value); } }