Exemplo n.º 1
0
      protected override void Jump(GotoStatement node, bool isContinue)
      {
        var labelInfo = _labelInfos.GetLabelInfo(node.Target);
        string error = null;
        if (labelInfo == null)
        {
          if (node.Target == null)
            if (isContinue)
              error = "SyntaxError: Illegal continue statement";
            else
              error = "SyntaxError: Illegal break statement";
          else
            error = string.Format("SyntaxError: Undefined label '{0}'", node.Target);
        }
        else
          if (isContinue && !labelInfo.HasContinueTarget)
            error = string.Format("SyntaxError: Undefined label '{0}'", node.Target);

        if (error != null)
        {
          var tmpException = new ThrowStatement(new StringLiteral(error));
          VisitNode(tmpException); //We call visit here to have the proper override of it get called.
          //TODO: var ErrorCall = new InternalCall(CodeGen.Types.Operations.Error.SemanticError, null);
        }
        else
        {
          var targetLabel = isContinue ? labelInfo.ContinueTarget : labelInfo.BreakTarget;
          bool isLeavingProtectedRegion = labelInfo.ProtectedRegion != _labelInfos.CurrProtectedRegion;
          if (isLeavingProtectedRegion)
            _ilGen.Leave(targetLabel);
          else
            _ilGen.Br(targetLabel);
        }
      }
Exemplo n.º 2
0
      public override void Visit(ThrowStatement node)
      {
        PushLocation(node);

        var stackState = _localVars.GetTemporaryStackState();
        VisitNode(node.Expression);
        _ilGen.Call(Types.JSException.Throw.Get(_result.ValueType));
        _localVars.PopTemporariesAfter(stackState);

        PopLocation();
      }
Exemplo n.º 3
0
 public override void Visit(ThrowStatement node) { Visit((Statement)node); }
Exemplo n.º 4
0
 public override void Visit(ThrowStatement node)
 {
   VisitNode(node.Expression);
   Visit((Statement)node);
 }
Exemplo n.º 5
0
      protected override void Jump(GotoStatement node, bool isContinue)
      {
        var labelInfo = _labelInfos.GetLabelInfo(node.Target);
        string error = null;
        if (labelInfo == null)
        {
          if (node.Target == null)
            if (isContinue)
              error = "SyntaxError: Illegal continue statement";
            else
              error = "SyntaxError: Illegal break statement";
          else
            error = string.Format("SyntaxError: Undefined label '{0}'", node.Target);
        }
        else
          if (isContinue && !labelInfo.HasContinueTarget)
            error = string.Format("SyntaxError: Undefined label '{0}'", node.Target);

        if (error != null)
        {
          var tmpException = new ThrowStatement(new StringLiteral(error));
          VisitNode(tmpException); //We call visit here to have the proper override of it get called.
          //TODO: var ErrorCall = new InternalCall(CodeGen.Types.Operations.Error.SemanticError, null);
        }
        else
        {
          //We reserve one slot in the _ics and later back fill these jumps. 
          (isContinue ? labelInfo.ContinueTarget : labelInfo.BreakTarget).AddLast(ReserveNewICIndex());
        }
      }
Exemplo n.º 6
0
      public override void Visit(ThrowStatement node)
      {
        PushLocation(node);

        VisitNode(node.Expression);

        BeginICMethod(node);
        _ilGen.LoadValue(_stackModel.StackPointer - 1);
        _ilGen.Call(Types.JSException.Throw.Get(mdr.ValueTypes.DValueRef));
        EndICMethod();

        _stackModel.Pop(1);

        PopLocation();
      }
Exemplo n.º 7
0
 public override void Visit(ThrowStatement node)
 {
     Visit((Statement)node);
 }
Exemplo n.º 8
0
 public abstract void Visit(ThrowStatement node);
Exemplo n.º 9
0
      public override void Visit(ThrowStatement node)
      {
        PushLocation(node);

        VisitNode(node.Expression);
        Call(Types.Operations.Stack.Throw, 1, 0);

        PopLocation();
      }
Exemplo n.º 10
0
 public override void Visit(ThrowStatement node)
 {
   throw new NotImplementedException();
 }
Exemplo n.º 11
0
 public override void Visit(ThrowStatement node) { }