예제 #1
0
        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
            );
        }
예제 #2
0
        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
            );
        }
예제 #3
0
 protected abstract Expression RewriteSet(AssignmentExtensionExpression node);
예제 #4
0
        private Expression Rewrite(AssignmentExtensionExpression node) {
            Expression lvalue = node.Expression;

            GlobalVariableExpression global = lvalue as GlobalVariableExpression;
            if (global != null) {
                return RewriteSet(node);
            }

            return node;
        }
예제 #5
0
 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);
     }
 }