projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed heinous breakage, added backtrace support
[org.ibex.core.git]
/
src
/
org
/
ibex
/
js
/
Interpreter.java
diff --git
a/src/org/ibex/js/Interpreter.java
b/src/org/ibex/js/Interpreter.java
index
59b48c3
..
ce83f69
100644
(file)
--- a/
src/org/ibex/js/Interpreter.java
+++ b/
src/org/ibex/js/Interpreter.java
@@
-235,16
+235,13
@@
class Interpreter implements ByteCodes, Tokens {
} else {
t = ((JS)target).getTrap(key);
}
} else {
t = ((JS)target).getTrap(key);
}
-
while (t != null && t.f.numFormalArgs == 0) t = t.next; // find the first write trap
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) {
}
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;
f = t.f;
scope = new Trap.TrapScope(f.parentScope, t, val);
pc = -1;
@@
-289,15
+286,12
@@
class Interpreter implements ByteCodes, Tokens {
} else {
t = ((JS)o).getTrap(v);
}
} else {
t = ((JS)o).getTrap(v);
}
-
while (t != null && t.f.numFormalArgs != 0) t = t.next; // get first read trap
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) {
}
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;
f = t.f;
scope = new Trap.TrapScope(f.parentScope, t, null);
((Trap.TrapScope)scope).cascadeHappened = true;
@@
-366,8
+360,9
@@
class Interpreter implements ByteCodes, Tokens {
}
case THROW:
}
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;
final JSScope final_scope = scope;
case MAKE_GRAMMAR: {
final Grammar r = (Grammar)arg;
final JSScope final_scope = scope;
@@
-389,7
+384,7
@@
class Interpreter implements ByteCodes, Tokens {
stack.push(r2);
break;
}
stack.push(r2);
break;
}
-
+ */
case ADD_TRAP: case DEL_TRAP: {
Object val = stack.pop();
Object key = stack.pop();
case ADD_TRAP: case DEL_TRAP: {
Object val = stack.pop();
Object key = stack.pop();
@@
-508,7
+503,6
@@
class Interpreter implements ByteCodes, Tokens {
}
} catch(JSExn e) {
}
} 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) {
while(stack.size() > 0) {
Object o = stack.pop();
if (o instanceof CatchMarker || o instanceof TryMarker) {
@@
-533,12
+527,6
@@
class Interpreter implements ByteCodes, Tokens {
pc = ((TryMarker)o).finallyLoc - 1;
continue OUTER;
}
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;
}
}
throw e;
@@
-689,7
+677,7
@@
class Interpreter implements ByteCodes, Tokens {
static Object getFromPrimitive(Object o, Object key) throws JSExn {
boolean returnJS = false;
if (o instanceof Boolean) {
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;
} else if (o instanceof Number) {
if (key.equals("toPrecision") || key.equals("toExponential") || key.equals("toFixed"))
returnJS = true;