コード例 #1
0
ファイル: Operand.cs プロジェクト: AqlaSolutions/runsharp
	    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
ファイル: Operand.cs プロジェクト: smartcaveman/runsharp
        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);
        }