public Number coerceToNumber() { throw new Error("you cannot coerce a " + this.getClass().getName() + " into a Number"); }
public String coerceToString() { throw new Error("you cannot coerce a " + this.getClass().getName() + " into a String"); }
public boolean coerceToBoolean() { throw new Error("you cannot coerce a " + this.getClass().getName() + " into a Boolean"); }
+
+ public String typeName() { return "object"; }
// Inner Classes /////////////////////////////////////////////////////////////////////////
CompiledFunction currentCompiledFunction = null;
Vec stack = new Vec();
- int line = -1;
+ int pc;
/** binds this thread to the current Java Thread */
public void bindToCurrentJavaThread() { javaThreadToJSThread.put(java.lang.Thread.currentThread(), this); }
/** returns the line of code that is currently executing */
- public int getLine() { return line; }
+ public int getLine() { return currentCompiledFunction == null ? -1 : currentCompiledFunction.getLine(pc); }
/** returns the name of the source code file which declared the currently executing function */
public String getSourceName() { return currentCompiledFunction == null ? null : currentCompiledFunction.getSourceName(); }
return ret;
}
+ public static JS.Thread currentJSThread() {
+ return fromJavaThread(java.lang.Thread.currentThread());
+ }
}
}