src/jdk/nashorn/internal/runtime/JSONFunctions.java
Print this page
*** 99,109 ****
// parse helpers
// apply 'reviver' function if available
private static Object applyReviver(final Global global, final Object unfiltered, final Object reviver) {
if (reviver instanceof ScriptFunction) {
- assert global instanceof Global;
final ScriptObject root = global.newObject();
root.addOwnProperty("", Property.WRITABLE_ENUMERABLE_CONFIGURABLE, unfiltered);
return walk(root, "", (ScriptFunction)reviver);
}
return unfiltered;
--- 99,108 ----
*** 198,208 ****
// add a new property if does not exist already, or else set old property
private static void setPropertyValue(final ScriptObject sobj, final String name, final Object value, final boolean strict) {
final int index = ArrayIndex.getArrayIndex(name);
if (ArrayIndex.isValidArrayIndex(index)) {
// array index key
! sobj.defineOwnProperty(index, value);
} else if (sobj.getMap().findProperty(name) != null) {
// pre-existing non-inherited property, call set
sobj.set(name, value, strict);
} else {
// add new property
--- 197,207 ----
// add a new property if does not exist already, or else set old property
private static void setPropertyValue(final ScriptObject sobj, final String name, final Object value, final boolean strict) {
final int index = ArrayIndex.getArrayIndex(name);
if (ArrayIndex.isValidArrayIndex(index)) {
// array index key
! sobj.defineOwnPropertyNoGap(index, value);
} else if (sobj.getMap().findProperty(name) != null) {
// pre-existing non-inherited property, call set
sobj.set(name, value, strict);
} else {
// add new property