Пример #1
0
        private int GenValues(CodeGenScope s, AstNode t, int val, int extra)
        {
            int n = 0;

            // TODO: support splat mode
//			bool is_splat;
            if (t is ArgsNode)
            {
                ArgsNode argsNode = t.As <ArgsNode> ();
                foreach (var arg in argsNode.args)
                {
                    Gen(s, arg, val);
                    n++;
                }
            }

            if (t is ExpressionListNode)
            {
                ExpressionListNode exprList = t.As <ExpressionListNode> ();
                foreach (var expr in exprList.exprs)
                {
                    Gen(s, expr, val);
                    n++;
                }
            }

            return(n);
        }
Пример #2
0
        public ForNode(AstNode var, AstNode obj, ExpressionListNode body)
        {
            this.var  = var;
            this.obj  = obj;
            this.body = body;

            args = new ArgsNode();
            args.Push(var);
        }
Пример #3
0
 public BlockNode(ArgsNode args, ExpressionListNode body)
 {
     car = args;
     cdr = body;
 }
Пример #4
0
 public DefNode(AstNode name, ArgsNode args, ExpressionListNode body)
 {
     this.name = name;
     this.args = args;
     this.body = body;
 }
Пример #5
0
 public BlockFunction(ArgsNode argumentNames, ExpressionListNode body, RubyContext context)
 {
     this.argumentNames = argumentNames;
     this.body          = body;
     this.context       = context;
 }
Пример #6
0
 public DefinedFunction(ExpressionListNode body, ArgsNode parameters, RubyContext context)
 {
     this.body       = body;
     this.context    = context;
     this.parameters = parameters;
 }