src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java

Print this page

        

*** 578,594 **** } else if (obj instanceof Number) { return new NativeNumber(((Number)obj).doubleValue(), this); } else if (obj instanceof String || obj instanceof ConsString) { return new NativeString((CharSequence)obj, this); } else if (obj instanceof Object[]) { // extension ! return new NativeArray((Object[])obj); } else if (obj instanceof double[]) { // extension ! return new NativeArray((double[])obj); } else if (obj instanceof long[]) { ! return new NativeArray((long[])obj); } else if (obj instanceof int[]) { ! return new NativeArray((int[])obj); } else { // FIXME: more special cases? Map? List? return obj; } } --- 578,596 ---- } else if (obj instanceof Number) { return new NativeNumber(((Number)obj).doubleValue(), this); } else if (obj instanceof String || obj instanceof ConsString) { return new NativeString((CharSequence)obj, this); } else if (obj instanceof Object[]) { // extension ! return new NativeArray(ArrayData.allocate((Object[])obj), this); } else if (obj instanceof double[]) { // extension ! return new NativeArray(ArrayData.allocate((double[])obj), this); } else if (obj instanceof long[]) { ! return new NativeArray(ArrayData.allocate((long[])obj), this); } else if (obj instanceof int[]) { ! return new NativeArray(ArrayData.allocate((int[]) obj), this); ! } else if (obj instanceof ArrayData) { ! return new NativeArray((ArrayData) obj, this); } else { // FIXME: more special cases? Map? List? return obj; } }
*** 1026,1043 **** System.exit(JSType.toInt32(code)); return UNDEFINED; } // builtin prototype accessors - ScriptObject getFunctionPrototype() { - return ScriptFunction.getPrototype(builtinFunction); - } ! ScriptObject getObjectPrototype() { return ScriptFunction.getPrototype(builtinObject); } ScriptObject getArrayPrototype() { return ScriptFunction.getPrototype(builtinArray); } ScriptObject getBooleanPrototype() { --- 1028,1050 ---- System.exit(JSType.toInt32(code)); return UNDEFINED; } // builtin prototype accessors ! /** ! * Get the builtin Object prototype. ! * @return the object prototype. ! */ ! public ScriptObject getObjectPrototype() { return ScriptFunction.getPrototype(builtinObject); } + ScriptObject getFunctionPrototype() { + return ScriptFunction.getPrototype(builtinFunction); + } + ScriptObject getArrayPrototype() { return ScriptFunction.getPrototype(builtinArray); } ScriptObject getBooleanPrototype() {