private void Visit(Block block) { var end = IL.DefineLabel(block.GetType().Name.ToLower() + "End"); switch (block) { case WhenBlock whenBlock: if (whenBlock.Condition != null) { Visit(whenBlock.Condition); LoadNumber(); IL.Brfalse(end); } Visit(whenBlock.Body); break; case StartupBlock startup: IL.Ldarg(2); IL.Brfalse(end); Visit(startup.Body); break; } IL.MarkLabel(end); }
private void Visit(TernaryOperatorExpression expr) { var labelFalse = IL.DefineLabel("tern_false"); var labelEnd = IL.DefineLabel("tern_end"); Visit(expr.Condition); LoadNumber(); IL.Brfalse(labelFalse); Visit(expr.IfTrue); IL.Br(labelEnd); IL.MarkLabel(labelFalse); IL.Nop(); Visit(expr.IfFalse); IL.MarkLabel(labelEnd); IL.Nop(); }