コード例 #1
0
 internal override void CompileBy(FunctionCompiler compiler)
 {
     Condition.CompileBy(compiler, false);
     if (_elseStatement == null)
     {
         var endLabel = compiler.Emitter.DefineLabel();
         compiler.Emitter.Emit(OpCode.GotoIfFalse, endLabel);
         ThenStatement.CompileBy(compiler);
         compiler.Emitter.MarkLabel(endLabel);
     }
     else
     {
         var endLabel   = compiler.Emitter.DefineLabel();
         var falseLabel = compiler.Emitter.DefineLabel();
         compiler.Emitter.Emit(OpCode.GotoIfFalse, falseLabel);
         _thenStatement.CompileBy(compiler);
         compiler.Emitter.Emit(OpCode.Goto, endLabel);
         compiler.Emitter.MarkLabel(falseLabel);
         _elseStatement.CompileBy(compiler);
         compiler.Emitter.MarkLabel(endLabel);
     }
     compiler.MarkEndOfStatement();
 }