protected internal virtual void EmitBranch(CodeGen g, OptionalLabel labelTrue, OptionalLabel labelFalse) { if (g == null) throw new ArgumentNullException(nameof(g)); OperandExtensions.SetLeakedState(this, false); EmitGet(g); if (labelTrue != null && labelTrue.IsLabelExist) { g.IL.Emit(BranchSet.Normal.BrTrue, labelTrue.Value); if (labelFalse != null && labelFalse.IsLabelExist) { g.IL.Emit(OpCodes.Br, labelFalse.Value); } } else if (labelFalse != null && labelFalse.IsLabelExist) { g.IL.Emit(BranchSet.Normal.BrFalse, labelFalse.Value); } else { throw new InvalidOperationException("No labels passed"); } }
protected internal virtual void EmitBranch(CodeGen g, OptionalLabel labelTrue, OptionalLabel labelFalse) { if (g == null) { throw new ArgumentNullException(nameof(g)); } OperandExtensions.SetLeakedState(this, false); EmitGet(g); if (labelTrue != null && labelTrue.IsLabelExist) { g.IL.Emit(BranchSet.Normal.BrTrue, labelTrue.Value); if (labelFalse != null && labelFalse.IsLabelExist) { g.IL.Emit(OpCodes.Br, labelFalse.Value); } } else if (labelFalse != null && labelFalse.IsLabelExist) { g.IL.Emit(BranchSet.Normal.BrFalse, labelFalse.Value); } else { throw new InvalidOperationException("No labels passed"); } }
protected override void EndImpl() { if (_test == null) { throw new InvalidOperationException("Loop condition has not been initialized"); } if (_iter != null) { if (_iterUsed) { G.IL.MarkLabel(_lbIter); } _iter.Emit(G); } G.IL.MarkLabel(_lbTest); var lbFalse = new OptionalLabel(G.IL); if (_endUsed) { lbFalse = _lbEnd; } Label?lbLoopCopy = _lbLoop; _test.EmitBranch(G, lbLoopCopy, lbFalse); if (lbFalse.IsLabelExist) { G.IL.MarkLabel(lbFalse.Value); } G.IsReachable = true; }
protected override void BeginImpl() { G.BeforeStatement(); _lbSkip = G.IL.DefineLabel(); _lbBegin = new OptionalLabel(G.IL); _condition.EmitBranch(G, _lbBegin, _lbSkip); if (_lbBegin.IsLabelExist) { G.IL.MarkLabel(_lbBegin.Value); } }
protected internal override void EmitBranch(CodeGen g, OptionalLabel labelTrue, OptionalLabel labelFalse) { OperandExtensions.SetLeakedState(this, false); _operand.EmitBranch(g, labelTrue, labelFalse); }