internal override void Walk(EmitContext ec) { if (ec.Resolving) { cond.Walk(ec); body.Walk(ec); } if (ec.Emitting) { Label end_label = ec.DefineLabel(); Label start_label = ec.DefineLabel(); ec.MarkLabel(start_label); cond.Walk(ec); if (this is RNUntil) { ec.EmitBranchIfTrue(end_label); } else { ec.EmitBranchIfFalse(end_label); } body.Walk(ec); // TODO return value in local ec.EmitDiscard(); ec.EmitBranch(start_label); ec.MarkLabel(end_label); ec.EmitNull(); } }
internal override void Walk(EmitContext ec) { if (ec.Resolving) { if (recv != null) { recv.Walk(ec); } if (args != null) { args.Walk(ec); } } if (ec.Emitting) { RNArray a = (RNArray)args; // rcver if (recv != null) { recv.Walk(ec); } else { ec.EmitSelf(); } // name ec.EmitString(mid); // args int len = a != null ? a.alen : 0; ec.EmitNewArgArray(len); EmitArgsArray(ec, a); // block if (block != null) { ec.EmitCreateBlock(block); } else { ec.EmitNull(); } ec.EmitSend(); } }
internal override void Walk(EmitContext ec) { if (ec.Resolving) { cond.Walk(ec); body.Walk(ec); if (nd_else != null) { nd_else.Walk(ec); } } if (ec.Emitting) { Label else_label = ec.DefineLabel(); Label end_label = ec.DefineLabel(); cond.Walk(ec); ec.EmitBranchIfFalse(else_label); // TODO rearrange the body and else clause in this case if (body != null) { body.Walk(ec); ec.EmitDiscard(); } if (nd_else != null) { ec.EmitBranch(end_label); } ec.MarkLabel(else_label); if (nd_else != null) { nd_else.Walk(ec); ec.EmitDiscard(); } ec.MarkLabel(end_label); ec.EmitNull(); } }
internal override void Walk(EmitContext ec) { if (ec.Resolving) { if (stts != null) { stts.Walk(ec); } } if (ec.Emitting) { // rcver ec.EmitBlockArg(); // thread ec.EmitLoadThread(); // args RNArray a = stts as RNArray; int len = a != null ? a.alen : (stts != null ? 1 : 0); ec.EmitNewArgArray(len); if (a != null) { RNCall.EmitArgsArray(ec, a); } else if (stts != null) { RNCall.EmitStoreArg(ec, 0, stts); } // block ec.EmitNull(); ec.EmitYield(); } }
internal override void Walk(EmitContext ec) { if(ec.Resolving) { cond.Walk(ec); body.Walk(ec); } if(ec.Emitting) { Label end_label = ec.DefineLabel(); Label start_label = ec.DefineLabel(); ec.MarkLabel(start_label); cond.Walk(ec); if(this is RNUntil) ec.EmitBranchIfTrue(end_label); else ec.EmitBranchIfFalse(end_label); body.Walk(ec); // TODO return value in local ec.EmitDiscard(); ec.EmitBranch(start_label); ec.MarkLabel(end_label); ec.EmitNull(); } }
internal override void Walk(EmitContext ec) { if(ec.Resolving) if(stts != null) stts.Walk(ec); if(ec.Emitting) { // rcver ec.EmitBlockArg(); // thread ec.EmitLoadThread(); // args RNArray a = stts as RNArray; int len = a != null ? a.alen : (stts != null ? 1 : 0); ec.EmitNewArgArray(len); if(a != null) { RNCall.EmitArgsArray(ec, a); } else if(stts != null) { RNCall.EmitStoreArg(ec, 0, stts); } // block ec.EmitNull(); ec.EmitYield(); } }
internal override void Walk(EmitContext ec) { if(ec.Resolving) { if(recv != null) recv.Walk(ec); if(args != null) args.Walk(ec); } if(ec.Emitting) { RNArray a = (RNArray)args; // rcver if(recv != null) { recv.Walk(ec); } else { ec.EmitSelf(); } // name ec.EmitString(mid); // args int len = a != null ? a.alen : 0; ec.EmitNewArgArray(len); EmitArgsArray(ec, a); // block if(block != null) { ec.EmitCreateBlock(block); } else { ec.EmitNull(); } ec.EmitSend(); } }
internal override void Walk(EmitContext ec) { if(ec.Resolving) { cond.Walk(ec); body.Walk(ec); if(nd_else != null) nd_else.Walk(ec); } if(ec.Emitting) { Label else_label = ec.DefineLabel(); Label end_label = ec.DefineLabel(); cond.Walk(ec); ec.EmitBranchIfFalse(else_label); // TODO rearrange the body and else clause in this case if(body != null) { body.Walk(ec); ec.EmitDiscard(); } if(nd_else != null) { ec.EmitBranch(end_label); } ec.MarkLabel(else_label); if(nd_else != null) { nd_else.Walk(ec); ec.EmitDiscard(); } ec.MarkLabel(end_label); ec.EmitNull(); } }