/** the scope in which this function was declared; by default this function is called in a fresh subscope of the parentScope */
private JS.Scope parentScope;
-
// Constructors ////////////////////////////////////////////////////////
private CompiledFunctionImpl cloneWithNewParentScope(JS.Scope s) throws IOException {
case TYPEOF: {
Object o = t.pop();
if (o == null) t.push(null);
- else if (o instanceof org.xwt.Box) t.push("Box");
- else if (o instanceof JS) t.push("Object");
- else if (o instanceof String) t.push("String");
- else if (o instanceof Number) t.push("Number");
- else if (o.getClass().getName().startsWith("org.xwt.js.")) t.push(o.getClass().getName().substring(11));
+ else if (o instanceof JS) t.push(((JS)o).typeName());
+ else if (o instanceof String) t.push("string");
+ else if (o instanceof Number) t.push("number");
+ else if (o instanceof Boolean) t.push("boolean");
else t.push("unknown");
break;
}
throw je("tried to put a value to the " + key + " property on the null value");
if (!(target instanceof JS))
throw je("tried to put a value to the " + key + " property on a " + target.getClass().getName());
+ if (key == null)
+ throw je("tried to assign \"" + (val==null?"(null)":val.toString()) + "\" to the null key");
((JS)target).put(key, val);
t.push(val);
break;
String sourceName;
public FunctionScope(String sourceName, Scope parentScope) { super(parentScope); this.sourceName = sourceName; }
public String getSourceName() { return sourceName; }
- public Object get(Object key) throws JS.Exn {
- if (key.equals("trapee")) return org.xwt.Trap.currentTrapee();
- else if (key.equals("trapname")) return org.xwt.Trap.currentTrapname();
- else if (key.equals("cascade")) return org.xwt.Trap.cascadeFunction;
- return super.get(key);
- }
}