예제 #1
0
	    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");
            }
	            
	    }
예제 #2
0
        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");
            }
        }
예제 #3
0
            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;
            }
예제 #4
0
            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);
                }
            }
예제 #5
0
 protected internal override void EmitBranch(CodeGen g, OptionalLabel labelTrue, OptionalLabel labelFalse)
 {
     OperandExtensions.SetLeakedState(this, false);
     _operand.EmitBranch(g, labelTrue, labelFalse);
 }
예제 #6
0
        protected internal override void EmitBranch(CodeGen g, OptionalLabel labelTrue, OptionalLabel labelFalse)
		{
		    OperandExtensions.SetLeakedState(this, false); 
            _operand.EmitBranch(g, labelTrue, labelFalse);
        }