more new js api fixes and cleanup
[org.ibex.core.git] / src / org / ibex / js / JSExn.java
index e01b769..1301199 100644 (file)
@@ -17,17 +17,15 @@ public class JSExn extends Exception {
     public JSExn(JS js, Interpreter.Stack stack, JSFunction f, int pc, JSScope scope) { this.js = js; fill(stack, f, pc, scope); }
     private void fill(Interpreter.Stack stack, JSFunction f, int pc, JSScope scope) {
         addBacktrace(f.sourceName + ":" + f.line[pc]);
-        // FIXME: "trap on property"
-        /*if (scope != null && scope instanceof Trap.TrapScope)
-            addBacktrace("trap on property \"" + ((Trap.TrapScope)scope).t.name + "\"");*/
         for(int i=stack.size()-1; i>=0; i--) {
             JS element = stack.elementAt(i);
             if (element instanceof Interpreter.CallMarker) {
                 Interpreter.CallMarker cm = (Interpreter.CallMarker)element;
-                if (cm.f != null)
-                    addBacktrace(cm.f.sourceName + ":" + cm.f.line[cm.pc-1]);
-                /*if (cm.scope != null && cm.scope instanceof Trap.TrapScope)
-                    addBacktrace("trap on property \"" + ((Trap.TrapScope)cm.scope).t.name + "\"");*/
+                if(cm.f == null) break;
+                String s = cm.f.sourceName + ":" + cm.f.line[cm.pc-1];
+                if(cm instanceof Interpreter.TrapMarker) 
+                    s += " (trap on " + JS.debugToString(((Interpreter.TrapMarker)cm).key) + ")";
+                addBacktrace(s);
             }
         }
     }