Example #1
0
 public override void Visit(IfStatement node)
 {
   VisitNode(node.Condition);
   VisitNode(node.Then);
   VisitNode(node.Else);
   Visit((Statement)node);
 }
Example #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();
      }
Example #3
0
 public override void Visit(IfStatement node) { Visit((Statement)node); }
      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();
      }
Example #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;
 }
Example #6
0
 public override void Visit(IfStatement node)
 {
   throw new NotImplementedException();
 }
Example #7
0
 public override void Visit(IfStatement node)
 {
   VisitNode(node.Then);
   VisitNode(node.Else);
 }