private void EmitConditional(FleeIlGenerator ilg, IServiceProvider services, BranchManager bm) { var falseLabel = bm.FindLabel("falseLabel"); var endLabel = bm.FindLabel("endLabel"); this.myCondition.Emit(ilg, services); var isTemp = ilg.IsTemp; if (isTemp) { bm.AddBranch(ilg, falseLabel); ilg.Emit(OpCodes.Brfalse_S, falseLabel); } else { var flag = !bm.IsLongBranch(ilg, falseLabel); ilg.Emit(flag ? OpCodes.Brfalse_S : OpCodes.Brfalse, falseLabel); } this.myWhenTrue.Emit(ilg, services); ImplicitConverter.EmitImplicitConvert(this.myWhenTrue.ResultType, this.myResultType, ilg); var isTemp2 = ilg.IsTemp; if (isTemp2) { bm.AddBranch(ilg, endLabel); ilg.Emit(OpCodes.Br_S, endLabel); } else { var flag2 = !bm.IsLongBranch(ilg, endLabel); ilg.Emit(flag2 ? OpCodes.Br_S : OpCodes.Br, endLabel); } bm.MarkLabel(ilg, falseLabel); ilg.MarkLabel(falseLabel); this.myWhenFalse.Emit(ilg, services); ImplicitConverter.EmitImplicitConvert(this.myWhenFalse.ResultType, this.myResultType, ilg); bm.MarkLabel(ilg, endLabel); ilg.MarkLabel(endLabel); }
private static void EmitBranchToTrueTerminal(FleeIlGenerator ilg, Label trueTerminal, BranchManager bm) { var isTemp = ilg.IsTemp; if (isTemp) { bm.AddBranch(ilg, trueTerminal); ilg.Emit(OpCodes.Brtrue_S, trueTerminal); } else { var flag = !bm.IsLongBranch(ilg, trueTerminal); ilg.Emit(flag ? OpCodes.Brtrue_S : OpCodes.Brtrue, trueTerminal); } }