public void Accept(TryCatchNode node)
 {
 }
Exemple #2
0
 public void Accept(TryCatchNode node)
 {
     var endLabel = nextLabel();
     var temp = method;
     method = new HassiumMethod();
     method.Name = "catch";
     table.PushScope();
     if (!table.ContainsSymbol("value"))
         table.AddSymbol("value");
     method.Parameters.Add(new FuncParameter("value"), table.GetSymbol("value"));
     node.CatchBody.VisitChildren(this);
     var handler = new HassiumExceptionHandler(temp, method, endLabel);
     if (!module.ObjectPool.ContainsKey(handler.GetHashCode()))
         module.ObjectPool.Add(handler.GetHashCode(), handler);
     method = temp;
     method.Emit(node.SourceLocation, InstructionType.PushHandler, handler.GetHashCode());
     node.TryBody.Visit(this);
     method.Emit(node.SourceLocation, InstructionType.PopHandler);
     method.EmitLabel(node.SourceLocation, endLabel);
 }