예제 #1
0
 public override void Visit(CatchClause node)
 {
   VisitNode(node.Statement);
   Visit((Node)node);
 }
예제 #2
0
      public override void Visit(CatchClause node)
      {
        _ilGen.BeginCatchBlock(Types.JSException.TypeOf);
        _labelInfos.PushProtectedRegion(node);

        ///At this point, the exception object is on the stack, however, the JSException is not a DObject
        ///that we can work with. So, we immediately load its .Value and use that one
        _ilGen.Ldflda(Types.JSException.Value);

        DeclareSymbols(node.Scope);

        var symbol = node.Identifier.Symbol;
        Debug.Assert(symbol != null, new JSSourceLocation(_currFuncMetadata, node.Statement), string.Format("Cannot find symbol for identifier {0} in catch clause", node.Identifier));

        ///It is important not to use symbol.Name since this is effectively a new scropt and there might be some other name clash!
        ///For example in the following case
        ///try { ... } catch(e) { try { ... } catch(e) { ... } }
        ///our current implementation is wrong specially if the catch identifier is closed on. But for now, we use a simple implementation
        ///for a good complicated example, see Tests/TryCatch9.js
        var local = _localVars.Get(symbol);
        Debug.Assert(local != null && local.LocalType == Types.DValue.TypeOf, "catch symbol must have a variable of type {0}", Types.DValue.TypeOf);
        //if (local == null)
        //  local = _localVars.Declare(_localVars.Declare(Types.DValue.RefOf), symbol);
        //_ilGen.Stloc(local);
        _ilGen.Ldloca(local);
        _ilGen.Call(Types.Operations.Assign.Get(mdr.ValueTypes.DValueRef));
        VisitNode(node.Statement);

        //_localVars.Release(symbol);
        _labelInfos.PopProtectedRegion(node);
      }
예제 #3
0
 public override void Visit(CatchClause node) { Visit((Node)node); }
예제 #4
0
 public override void Visit(CatchClause node)
 {
     Visit((Node)node);
 }
예제 #5
0
 public abstract void Visit(CatchClause node);
예제 #6
0
      public override void Visit(CatchClause node)
      {
        _ilGen.BeginCatchBlock(Types.JSException.TypeOf);
        _labelInfos.PushProtectedRegion(node);

        StoreStackSp(0); //Empty the stack

        //At this point, the exception object is on the stack
        _ilGen.Ldflda(Types.JSException.Value);

        Call(Types.Operations.Stack.LoadDValue, 0, 1);

        var symbol = node.Identifier.Symbol;// _currFuncMetadata.GetSymbol(expression.Catch.Identifier);
        Debug.Assert(symbol != null, new JSSourceLocation(_currFuncMetadata, node.Statement), string.Format("Cannot find symbol for identifier {0} in catch clause", node.Identifier));
        WriteResults(symbol, false);

        VisitNode(node.Statement);
        _labelInfos.PopProtectedRegion(node);
      }
예제 #7
0
 public override void Visit(CatchClause node)
 {
   throw new NotImplementedException();
 }