private static int toDenseIndex(Object id) { long index = toArrayIndex(id); return 0 <= index && index < Integer.MAX_VALUE ? (int) index : -1; }
private static int toDenseIndex(Object id) { long index = toArrayIndex(id); return 0 <= index && index < Integer.MAX_VALUE ? (int) index : -1; }
private static int toDenseIndex(Object id) { long index = toArrayIndex(id); return 0 <= index && index < Integer.MAX_VALUE ? (int) index : -1; }
private static int toDenseIndex(Object id) { long index = toArrayIndex(id); return 0 <= index && index < Integer.MAX_VALUE ? (int) index : -1; }
private static long toArrayIndex(Object id) { if (id instanceof String) { return toArrayIndex((String)id); } else if (id instanceof Number) { return toArrayIndex(((Number)id).doubleValue()); } return -1; }
private static long toArrayIndex(Object id) { if (id instanceof String) { return toArrayIndex((String)id); } else if (id instanceof Number) { return toArrayIndex(((Number)id).doubleValue()); } return -1; }
private static long toArrayIndex(Object id) { if (id instanceof String) { return toArrayIndex((String)id); } else if (id instanceof Number) { return toArrayIndex(((Number)id).doubleValue()); } return -1; }
private static long toArrayIndex(Object id) { if (id instanceof String) { return toArrayIndex((String)id); } else if (id instanceof Number) { return toArrayIndex(((Number)id).doubleValue()); } return -1; }
public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; } } }
private static long toArrayIndex(String id) { long index = toArrayIndex(ScriptRuntime.toNumber(id)); // Assume that ScriptRuntime.toString(index) is the same // as java.lang.Long.toString(index) for long if (Long.toString(index).equals(id)) { return index; } return -1; }
@Override public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; denseOnly = false; } } }
private static long toArrayIndex(String id) { long index = toArrayIndex(ScriptRuntime.toNumber(id)); // Assume that ScriptRuntime.toString(index) is the same // as java.lang.Long.toString(index) for long if (Long.toString(index).equals(id)) { return index; } return -1; }
private static long toArrayIndex(String id) { long index = toArrayIndex(ScriptRuntime.toNumber(id)); // Assume that ScriptRuntime.toString(index) is the same // as java.lang.Long.toString(index) for long if (Long.toString(index).equals(id)) { return index; } return -1; }
private static long toArrayIndex(String id) { long index = toArrayIndex(ScriptRuntime.toNumber(id)); // Assume that ScriptRuntime.toString(index) is the same // as java.lang.Long.toString(index) for long if (Long.toString(index).equals(id)) { return index; } return -1; }
@Override public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; denseOnly = false; } } }
@Override public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; denseOnly = false; } } }
@Override public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; denseOnly = false; } } }
@Override public void put(String id, Scriptable start, Object value) { super.put(id, start, value); if (start == this) { // If the object is sealed, super will throw exception long index = toArrayIndex(id); if (index >= length) { length = index + 1; denseOnly = false; } } }
@Override protected void defineOwnProperty(Context cx, Object id, ScriptableObject desc, boolean checkValid) { if (dense != null) { Object[] values = dense; dense = null; denseOnly = false; for (int i = 0; i < values.length; i++) { if (values[i] != NOT_FOUND) { put(i, this, values[i]); } } } long index = toArrayIndex(id); if (index >= length) { length = index + 1; } super.defineOwnProperty(cx, id, desc, checkValid); }
@Override protected void defineOwnProperty(Context cx, Object id, ScriptableObject desc, boolean checkValid) { if (dense != null) { Object[] values = dense; dense = null; denseOnly = false; for (int i = 0; i < values.length; i++) { if (values[i] != NOT_FOUND) { put(i, this, values[i]); } } } long index = toArrayIndex(id); if (index >= length) { length = index + 1; } super.defineOwnProperty(cx, id, desc, checkValid); }