예제 #1
0
 public override void Visit(IfStatement node)
 {
   VisitNode(node.Condition);
   VisitNode(node.Then);
   VisitNode(node.Else);
   Visit((Statement)node);
 }
예제 #2
0
      public override void Visit(IfStatement node)
      {
        PushLocation(node);

        System.Reflection.Emit.Label endLabel;
        System.Reflection.Emit.Label elseLabel = _ilGen.DefineLabel();

        var stackState = _localVars.GetTemporaryStackState();
        VisitNode(node.Condition);
        AsBoolean();
        _ilGen.Brfalse(elseLabel);
        _localVars.PopTemporariesAfter(stackState);

        VisitNode(node.Then);

        if (node.Else != null)
        {
          endLabel = _ilGen.DefineLabel();
          _ilGen.Br(endLabel);
          _ilGen.MarkLabel(elseLabel);
          VisitNode(node.Else);
          _ilGen.MarkLabel(endLabel);
        }
        else
          _ilGen.MarkLabel(elseLabel);

        PopLocation();
      }
예제 #3
0
 public override void Visit(IfStatement node) { Visit((Statement)node); }
예제 #4
0
      public override void Visit(IfStatement node)
      {
        PushLocation(node);

        VisitNode(node.Condition);
        _stackModel.Pop(1);
        var conditionIndex = _stackModel.StackPointer;
        var gotoElseIndex = ReserveNewICIndex();
        VisitNode(node.Then);

        int elseIndex;
        if (node.Else != null)
        {
          var gotoEndIndex = ReserveNewICIndex();

          elseIndex = gotoEndIndex + 1;

          VisitNode(node.Else);

          var endIndex = GetCurrentICIndex() + 1;
          BeginICMethod("GotoEnd");
          Br(endIndex);
          EndICMethod(gotoEndIndex);
        }
        else
          elseIndex = GetCurrentICIndex() + 1;

        BeginICMethod("GotoElse");
        Brfalse(conditionIndex, elseIndex);
        EndICMethod(gotoElseIndex);

        PopLocation();
      }
예제 #5
0
 public IfStatement MakeIfStatement(IExpression condition, IStatement thenStatement, IStatement elseStatement = null)
 {
   var booleanCondition = MakeToBoolean((Expression)condition);
   var n = new IfStatement(booleanCondition, (Statement)thenStatement, (Statement)elseStatement);
   return n;
 }
예제 #6
0
 public override void Visit(IfStatement node)
 {
   throw new NotImplementedException();
 }
예제 #7
0
 public override void Visit(IfStatement node)
 {
   VisitNode(node.Then);
   VisitNode(node.Else);
 }