internal override void Assign(CodeGenContext context, Node rhs) { // Gen right hand sides ListGen mrhs; if (rhs is ListGen && !(rhs is MultipleRHS)) mrhs = (ListGen)rhs; else mrhs = new ARGS(null, null, rhs, null, location, true); bool created; ISimple list = mrhs.GenArgList(context, out created); list.GenSimple(context); context.callvirt(Runtime.ArgList.CheckSingleRHS); int array = context.StoreInTemp("mrhs", Runtime.ArgListRef, location); context.ReleaseLocal(list, created); // Gen assignments to left hand sides for (LVALUE l = elements; l != null; l = (LVALUE)l.nd_next) { l.Assign(context, new MultipleRHS(array, l.location)); context.pop(); } context.ldloc(array); context.callvirt(Runtime.ArgList.ToRubyArray); context.ReleaseLocal(array, true); }
internal ARRAY(Node args, YYLTYPE location) : base(location) { if (args is ARGS) this.args = (ARGS)args; else this.args = new ARGS(args, null, null, null, args.location, false); }
internal ControlFlowNode(Scope parent_scope, ARGS return_val, YYLTYPE location) : base(location) { this.parent_scope = parent_scope; // no return value if (return_val == null) return; if (return_val.block != null) throw new System.Exception("block argument should not be given"); // just a single value => return that value if (return_val.hashlist == null && return_val.array == null && return_val.parameters.nd_next == null) { this.return_val = return_val.parameters; return; } // just hash values => return a HASH if (return_val.parameters == null && return_val.array == null) { this.return_val = new HASH(return_val.hashlist, return_val.location); return; } // return *p => if p is an ARRAY then ... else ... if (return_val.parameters == null && return_val.hashlist == null) { this.array = return_val.array; this.return_val = new ProxyNode(ReturnArray, return_val.location); } else { this.args = return_val; this.return_val = new ProxyNode(ReturnRubyArray, return_val.location); } }
// [ args ] internal ARRAY(YYLTYPE location) : base(location) { this.args = null; }
private Node body; // optional internal WHEN(Node comparison, Node body, Node next, YYLTYPE location) : base(location) { Debug.Assert(comparison != null); this.comparison = (ARGS)comparison; this.body = body; this.nd_next = next; }