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
            );
        }
Exemple #3
0
 protected abstract Expression RewriteSet(AssignmentExtensionExpression node);
Exemple #4
0
        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);
     }
 }