} else {
t = ((JS)target).getTrap(key);
}
-
while (t != null && t.f.numFormalArgs == 0) t = t.next; // find the first write trap
- if (t != null) {
- stack.push(new CallMarker(this));
- JSArray args = new JSArray();
- args.addElement(val);
- stack.push(args);
- }
}
if (t != null) {
+ stack.push(new CallMarker(this));
+ JSArray args = new JSArray();
+ args.addElement(val);
+ stack.push(args);
f = t.f;
scope = new Trap.TrapScope(f.parentScope, t, val);
pc = -1;
} else {
t = ((JS)o).getTrap(v);
}
-
while (t != null && t.f.numFormalArgs != 0) t = t.next; // get first read trap
- if (t != null) {
- stack.push(new CallMarker(this));
- JSArray args = new JSArray();
- stack.push(args);
- }
}
if (t != null) {
+ stack.push(new CallMarker(this));
+ JSArray args = new JSArray();
+ stack.push(args);
f = t.f;
scope = new Trap.TrapScope(f.parentScope, t, null);
((Trap.TrapScope)scope).cascadeHappened = true;
}
case THROW:
- throw new JSExn(stack.pop());
+ throw new JSExn(stack.pop(), stack, f, pc, scope);
+
/* FIXME
case MAKE_GRAMMAR: {
final Grammar r = (Grammar)arg;
}
} catch(JSExn e) {
- if(f.op[pc] != FINALLY_DONE) e.addBacktrace(f.sourceName,f.line[pc]);
while(stack.size() > 0) {
Object o = stack.pop();
if (o instanceof CatchMarker || o instanceof TryMarker) {
pc = ((TryMarker)o).finallyLoc - 1;
continue OUTER;
}
- } else if(o instanceof CallMarker) {
- CallMarker cm = (CallMarker) o;
- if(cm.f == null)
- e.addBacktrace("<java>",0); // This might not even be worth mentioning
- else
- e.addBacktrace(cm.f.sourceName,cm.f.line[cm.pc-1]);
}
}
throw e;
static Object getFromPrimitive(Object o, Object key) throws JSExn {
boolean returnJS = false;
if (o instanceof Boolean) {
- throw new JSExn("cannot call methods on Booleans");
+ throw new JSExn("Booleans do not have properties");
} else if (o instanceof Number) {
if (key.equals("toPrecision") || key.equals("toExponential") || key.equals("toFixed"))
returnJS = true;