--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Thu Mar 26 13:09:11 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Wed Apr 01 12:29:49 2015 -0700
@@ -54,8 +54,10 @@
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import jdk.nashorn.internal.lookup.Lookup;
import jdk.nashorn.internal.objects.annotations.Attribute;
+import jdk.nashorn.internal.objects.annotations.Getter;
import jdk.nashorn.internal.objects.annotations.Property;
import jdk.nashorn.internal.objects.annotations.ScriptClass;
+import jdk.nashorn.internal.objects.annotations.Setter;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ECMAErrors;
import jdk.nashorn.internal.runtime.GlobalConstants;
@@ -77,6 +79,7 @@
import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
import jdk.nashorn.internal.runtime.regexp.RegExpResult;
import jdk.nashorn.internal.scripts.JO;
+import jdk.nashorn.tools.ShellFunctions;
/**
* Representation of global scope.
@@ -88,6 +91,9 @@
private final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class);
private final InvokeByName VALUE_OF = new InvokeByName("valueOf", ScriptObject.class);
+ // placeholder value for lazily initialized global objects
+ private static final Object LAZY_SENTINEL = new Object();
+
/**
* Optimistic builtin names that require switchpoint invalidation
* upon assignment. Overly conservative, but works for now, to avoid
@@ -213,20 +219,76 @@
public volatile Object number;
/** ECMA 15.1.4.7 Date constructor */
- @Property(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object date;
+ @Getter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getDate(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.date == LAZY_SENTINEL) {
+ global.date = global.getBuiltinDate();
+ }
+ return global.date;
+ }
+
+ @Setter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setDate(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.date = value;
+ }
+
+ private volatile Object date = LAZY_SENTINEL;
/** ECMA 15.1.4.8 RegExp constructor */
- @Property(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object regexp;
+ @Getter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getRegExp(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.regexp == LAZY_SENTINEL) {
+ global.regexp = global.getBuiltinRegExp();
+ }
+ return global.regexp;
+ }
+
+ @Setter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setRegExp(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.regexp = value;
+ }
+
+ private volatile Object regexp = LAZY_SENTINEL;
/** ECMA 15.12 - The JSON object */
- @Property(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object json;
+ @Getter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getJSON(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.json == LAZY_SENTINEL) {
+ global.json = global.getBuiltinJSON();
+ }
+ return global.json;
+ }
+
+ @Setter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setJSON(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.json = value;
+ }
+
+ private volatile Object json = LAZY_SENTINEL;
/** Nashorn extension: global.JSAdapter */
- @Property(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object jsadapter;
+ @Getter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getJSAdapter(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.jsadapter == LAZY_SENTINEL) {
+ global.jsadapter = global.getBuiltinJSAdapter();
+ }
+ return global.jsadapter;
+ }
+
+ @Setter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setJSAdapter(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.jsadapter = value;
+ }
+
+ private volatile Object jsadapter = LAZY_SENTINEL;
/** ECMA 15.8 - The Math object */
@Property(name = "Math", attributes = Attribute.NOT_ENUMERABLE)
@@ -237,12 +299,40 @@
public volatile Object error;
/** EvalError object */
- @Property(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object evalError;
+ @Getter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getEvalError(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.evalError == LAZY_SENTINEL) {
+ global.evalError = global.getBuiltinEvalError();
+ }
+ return global.evalError;
+ }
+
+ @Setter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setEvalError(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.evalError = value;
+ }
+
+ private volatile Object evalError = LAZY_SENTINEL;
/** RangeError object */
- @Property(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object rangeError;
+ @Getter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getRangeError(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.rangeError == LAZY_SENTINEL) {
+ global.rangeError = global.getBuiltinRangeError();
+ }
+ return global.rangeError;
+ }
+
+ @Setter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setRangeError(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.rangeError = value;
+ }
+
+ private volatile Object rangeError = LAZY_SENTINEL;
/** ReferenceError object */
@Property(name = "ReferenceError", attributes = Attribute.NOT_ENUMERABLE)
@@ -257,52 +347,220 @@
public volatile Object typeError;
/** URIError object */
- @Property(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object uriError;
+ @Getter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getURIError(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.uriError == LAZY_SENTINEL) {
+ global.uriError = global.getBuiltinURIError();
+ }
+ return global.uriError;
+ }
+
+ @Setter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setURIError(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.uriError = value;
+ }
+
+ private volatile Object uriError = LAZY_SENTINEL;
/** ArrayBuffer object */
- @Property(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object arrayBuffer;
+ @Getter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getArrayBuffer(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.arrayBuffer == LAZY_SENTINEL) {
+ global.arrayBuffer = global.getBuiltinArrayBuffer();
+ }
+ return global.arrayBuffer;
+ }
+
+ @Setter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setArrayBuffer(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.arrayBuffer = value;
+ }
+
+ private volatile Object arrayBuffer;
/** DataView object */
- @Property(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object dataView;
+ @Getter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getDataView(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.dataView == LAZY_SENTINEL) {
+ global.dataView = global.getBuiltinDataView();
+ }
+ return global.dataView;
+ }
+
+ @Setter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setDataView(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.dataView = value;
+ }
+
+ private volatile Object dataView;
/** TypedArray (int8) */
- @Property(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object int8Array;
+ @Getter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getInt8Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.int8Array == LAZY_SENTINEL) {
+ global.int8Array = global.getBuiltinInt8Array();
+ }
+ return global.int8Array;
+ }
+
+ @Setter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setInt8Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.int8Array = value;
+ }
+
+ private volatile Object int8Array;
/** TypedArray (uint8) */
- @Property(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object uint8Array;
+ @Getter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getUint8Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.uint8Array == LAZY_SENTINEL) {
+ global.uint8Array = global.getBuiltinUint8Array();
+ }
+ return global.uint8Array;
+ }
+
+ @Setter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setUint8Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.uint8Array = value;
+ }
+
+ private volatile Object uint8Array;
/** TypedArray (uint8) - Clamped */
- @Property(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object uint8ClampedArray;
+ @Getter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getUint8ClampedArray(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.uint8ClampedArray == LAZY_SENTINEL) {
+ global.uint8ClampedArray = global.getBuiltinUint8ClampedArray();
+ }
+ return global.uint8ClampedArray;
+ }
+
+ @Setter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setUint8ClampedArray(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.uint8ClampedArray = value;
+ }
+
+ private volatile Object uint8ClampedArray;
/** TypedArray (int16) */
- @Property(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object int16Array;
+ @Getter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getInt16Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.int16Array == LAZY_SENTINEL) {
+ global.int16Array = global.getBuiltinInt16Array();
+ }
+ return global.int16Array;
+ }
+
+ @Setter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setInt16Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.int16Array = value;
+ }
+
+ private volatile Object int16Array;
/** TypedArray (uint16) */
- @Property(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object uint16Array;
+ @Getter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getUint16Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.uint16Array == LAZY_SENTINEL) {
+ global.uint16Array = global.getBuiltinUint16Array();
+ }
+ return global.uint16Array;
+ }
+
+ @Setter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setUint16Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.uint16Array = value;
+ }
+
+ private volatile Object uint16Array;
/** TypedArray (int32) */
- @Property(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object int32Array;
+ @Getter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getInt32Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.int32Array == LAZY_SENTINEL) {
+ global.int32Array = global.getBuiltinInt32Array();
+ }
+ return global.int32Array;
+ }
+
+ @Setter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setInt32Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.int32Array = value;
+ }
+
+ private volatile Object int32Array;
/** TypedArray (uint32) */
- @Property(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object uint32Array;
+ @Getter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getUint32Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.uint32Array == LAZY_SENTINEL) {
+ global.uint32Array = global.getBuiltinUint32Array();
+ }
+ return global.uint32Array;
+ }
+
+ @Setter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setUint32Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.uint32Array = value;
+ }
+
+ private volatile Object uint32Array;
/** TypedArray (float32) */
- @Property(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object float32Array;
+ @Getter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getFloat32Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.float32Array == LAZY_SENTINEL) {
+ global.float32Array = global.getBuiltinFloat32Array();
+ }
+ return global.float32Array;
+ }
+
+ @Setter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setFloat32Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.float32Array = value;
+ }
+
+ private volatile Object float32Array;
/** TypedArray (float64) */
- @Property(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object float64Array;
+ @Getter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getFloat64Array(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.float64Array == LAZY_SENTINEL) {
+ global.float64Array = global.getBuiltinFloat64Array();
+ }
+ return global.float64Array;
+ }
+
+ @Setter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setFloat64Array(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.float64Array = value;
+ }
+
+ private volatile Object float64Array;
/** Nashorn extension: Java access - global.Packages */
@Property(name = "Packages", attributes = Attribute.NOT_ENUMERABLE)
@@ -333,12 +591,40 @@
public volatile Object org;
/** Nashorn extension: Java access - global.javaImporter */
- @Property(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object javaImporter;
+ @Getter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getJavaImporter(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.javaImporter == LAZY_SENTINEL) {
+ global.javaImporter = global.getBuiltinJavaImporter();
+ }
+ return global.javaImporter;
+ }
+
+ @Setter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setJavaImporter(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.javaImporter = value;
+ }
+
+ private volatile Object javaImporter;
/** Nashorn extension: global.Java Object constructor. */
- @Property(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
- public volatile Object javaApi;
+ @Getter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
+ public static Object getJavaApi(final Object self) {
+ final Global global = Global.instanceFrom(self);
+ if (global.javaApi == LAZY_SENTINEL) {
+ global.javaApi = global.getBuiltinJavaApi();
+ }
+ return global.javaApi;
+ }
+
+ @Setter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
+ public static void setJavaApi(final Object self, final Object value) {
+ final Global global = Global.instanceFrom(self);
+ global.javaApi = value;
+ }
+
+ private volatile Object javaApi;
/** Nashorn extension: current script's file name */
@Property(name = "__FILE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT)
@@ -352,11 +638,19 @@
@Property(name = "__LINE__", attributes = Attribute.NON_ENUMERABLE_CONSTANT)
public final Object __LINE__ = LOCATION_PROPERTY_PLACEHOLDER;
+ private volatile NativeDate DEFAULT_DATE;
+
/** Used as Date.prototype's default value */
- public NativeDate DEFAULT_DATE;
+ NativeDate getDefaultDate() {
+ return DEFAULT_DATE;
+ }
+
+ private volatile NativeRegExp DEFAULT_REGEXP;
/** Used as RegExp.prototype's default value */
- public NativeRegExp DEFAULT_REGEXP;
+ NativeRegExp getDefaultRegExp() {
+ return DEFAULT_REGEXP;
+ }
/*
* Built-in constructor objects: Even if user changes dynamic values of
@@ -1033,7 +1327,7 @@
/**
* Get the builtin Object prototype.
- * @return the object prototype.
+ * @return the object prototype.
*/
public ScriptObject getObjectPrototype() {
return ScriptFunction.getPrototype(builtinObject);
@@ -1056,11 +1350,11 @@
}
ScriptObject getDatePrototype() {
- return ScriptFunction.getPrototype(builtinDate);
+ return ScriptFunction.getPrototype(getBuiltinDate());
}
ScriptObject getRegExpPrototype() {
- return ScriptFunction.getPrototype(builtinRegExp);
+ return ScriptFunction.getPrototype(getBuiltinRegExp());
}
ScriptObject getStringPrototype() {
@@ -1072,11 +1366,11 @@
}
ScriptObject getEvalErrorPrototype() {
- return ScriptFunction.getPrototype(builtinEvalError);
+ return ScriptFunction.getPrototype(getBuiltinEvalError());
}
ScriptObject getRangeErrorPrototype() {
- return ScriptFunction.getPrototype(builtinRangeError);
+ return ScriptFunction.getPrototype(getBuiltinRangeError());
}
ScriptObject getReferenceErrorPrototype() {
@@ -1092,59 +1386,136 @@
}
ScriptObject getURIErrorPrototype() {
- return ScriptFunction.getPrototype(builtinURIError);
+ return ScriptFunction.getPrototype(getBuiltinURIError());
}
ScriptObject getJavaImporterPrototype() {
- return ScriptFunction.getPrototype(builtinJavaImporter);
+ return ScriptFunction.getPrototype(getBuiltinJavaImporter());
}
ScriptObject getJSAdapterPrototype() {
- return ScriptFunction.getPrototype(builtinJSAdapter);
+ return ScriptFunction.getPrototype(getBuiltinJSAdapter());
+ }
+
+ private synchronized ScriptFunction getBuiltinArrayBuffer() {
+ if (this.builtinArrayBuffer == null) {
+ this.builtinArrayBuffer = initConstructorAndSwitchPoint("ArrayBuffer", ScriptFunction.class);
+ }
+ return this.builtinArrayBuffer;
}
ScriptObject getArrayBufferPrototype() {
- return ScriptFunction.getPrototype(builtinArrayBuffer);
+ return ScriptFunction.getPrototype(getBuiltinArrayBuffer());
+ }
+
+ private synchronized ScriptFunction getBuiltinDataView() {
+ if (this.builtinDataView == null) {
+ this.builtinDataView = initConstructorAndSwitchPoint("DataView", ScriptFunction.class);
+ }
+ return this.builtinDataView;
}
ScriptObject getDataViewPrototype() {
- return ScriptFunction.getPrototype(builtinDataView);
+ return ScriptFunction.getPrototype(getBuiltinDataView());
+ }
+
+ private synchronized ScriptFunction getBuiltinInt8Array() {
+ if (this.builtinInt8Array == null) {
+ this.builtinInt8Array = initConstructorAndSwitchPoint("Int8Array", ScriptFunction.class);
+ }
+ return this.builtinInt8Array;
}
ScriptObject getInt8ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinInt8Array);
+ return ScriptFunction.getPrototype(getBuiltinInt8Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinUint8Array() {
+ if (this.builtinUint8Array == null) {
+ this.builtinUint8Array = initConstructorAndSwitchPoint("Uint8Array", ScriptFunction.class);
+ }
+ return this.builtinUint8Array;
}
ScriptObject getUint8ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinUint8Array);
+ return ScriptFunction.getPrototype(getBuiltinUint8Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinUint8ClampedArray() {
+ if (this.builtinUint8ClampedArray == null) {
+ this.builtinUint8ClampedArray = initConstructorAndSwitchPoint("Uint8ClampedArray", ScriptFunction.class);
+ }
+ return this.builtinUint8ClampedArray;
}
ScriptObject getUint8ClampedArrayPrototype() {
- return ScriptFunction.getPrototype(builtinUint8ClampedArray);
+ return ScriptFunction.getPrototype(getBuiltinUint8ClampedArray());
+ }
+
+ private synchronized ScriptFunction getBuiltinInt16Array() {
+ if (this.builtinInt16Array == null) {
+ this.builtinInt16Array = initConstructorAndSwitchPoint("Int16Array", ScriptFunction.class);
+ }
+ return this.builtinInt16Array;
}
ScriptObject getInt16ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinInt16Array);
+ return ScriptFunction.getPrototype(getBuiltinInt16Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinUint16Array() {
+ if (this.builtinUint16Array == null) {
+ this.builtinUint16Array = initConstructorAndSwitchPoint("Uint16Array", ScriptFunction.class);
+ }
+ return this.builtinUint16Array;
}
ScriptObject getUint16ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinUint16Array);
+ return ScriptFunction.getPrototype(getBuiltinUint16Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinInt32Array() {
+ if (this.builtinInt32Array == null) {
+ this.builtinInt32Array = initConstructorAndSwitchPoint("Int32Array", ScriptFunction.class);
+ }
+ return this.builtinInt32Array;
}
ScriptObject getInt32ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinInt32Array);
+ return ScriptFunction.getPrototype(getBuiltinInt32Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinUint32Array() {
+ if (this.builtinUint32Array == null) {
+ this.builtinUint32Array = initConstructorAndSwitchPoint("Uint32Array", ScriptFunction.class);
+ }
+ return this.builtinUint32Array;
}
ScriptObject getUint32ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinUint32Array);
+ return ScriptFunction.getPrototype(getBuiltinUint32Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinFloat32Array() {
+ if (this.builtinFloat32Array == null) {
+ this.builtinFloat32Array = initConstructorAndSwitchPoint("Float32Array", ScriptFunction.class);
+ }
+ return this.builtinFloat32Array;
}
ScriptObject getFloat32ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinFloat32Array);
+ return ScriptFunction.getPrototype(getBuiltinFloat32Array());
+ }
+
+ private synchronized ScriptFunction getBuiltinFloat64Array() {
+ if (this.builtinFloat64Array == null) {
+ this.builtinFloat64Array = initConstructorAndSwitchPoint("Float64Array", ScriptFunction.class);
+ }
+ return this.builtinFloat64Array;
}
ScriptObject getFloat64ArrayPrototype() {
- return ScriptFunction.getPrototype(builtinFloat64Array);
+ return ScriptFunction.getPrototype(getBuiltinFloat64Array());
}
private ScriptFunction getBuiltinArray() {
@@ -1179,8 +1550,14 @@
return instance._boolean == instance.getBuiltinBoolean();
}
- private ScriptFunction getBuiltinDate() {
- return builtinDate;
+ private synchronized ScriptFunction getBuiltinDate() {
+ if (this.builtinDate == null) {
+ this.builtinDate = initConstructorAndSwitchPoint("Date", ScriptFunction.class);
+ final ScriptObject dateProto = ScriptFunction.getPrototype(builtinDate);
+ // initialize default date
+ this.DEFAULT_DATE = new NativeDate(NaN, dateProto);
+ }
+ return this.builtinDate;
}
/**
@@ -1190,7 +1567,7 @@
*/
public static boolean isBuiltinDate() {
final Global instance = Global.instance();
- return instance.date == instance.getBuiltinDate();
+ return instance.date == LAZY_SENTINEL || instance.date == instance.getBuiltinDate();
}
private ScriptFunction getBuiltinError() {
@@ -1207,8 +1584,11 @@
return instance.error == instance.getBuiltinError();
}
- private ScriptFunction getBuiltinEvalError() {
- return builtinEvalError;
+ private synchronized ScriptFunction getBuiltinEvalError() {
+ if (this.builtinEvalError == null) {
+ this.builtinEvalError = initErrorSubtype("EvalError", getErrorPrototype());
+ }
+ return this.builtinEvalError;
}
/**
@@ -1218,7 +1598,7 @@
*/
public static boolean isBuiltinEvalError() {
final Global instance = Global.instance();
- return instance.evalError == instance.getBuiltinEvalError();
+ return instance.evalError == LAZY_SENTINEL || instance.evalError == instance.getBuiltinEvalError();
}
private ScriptFunction getBuiltinFunction() {
@@ -1269,7 +1649,10 @@
return isBuiltinFunctionProperty("call");
}
- private ScriptFunction getBuiltinJSAdapter() {
+ private synchronized ScriptFunction getBuiltinJSAdapter() {
+ if (this.builtinJSAdapter == null) {
+ this.builtinJSAdapter = initConstructorAndSwitchPoint("JSAdapter", ScriptFunction.class);
+ }
return builtinJSAdapter;
}
@@ -1280,11 +1663,14 @@
*/
public static boolean isBuiltinJSAdapter() {
final Global instance = Global.instance();
- return instance.jsadapter == instance.getBuiltinJSAdapter();
+ return instance.jsadapter == LAZY_SENTINEL || instance.jsadapter == instance.getBuiltinJSAdapter();
}
- private ScriptObject getBuiltinJSON() {
- return builtinJSON;
+ private synchronized ScriptObject getBuiltinJSON() {
+ if (this.builtinJSON == null) {
+ this.builtinJSON = initConstructorAndSwitchPoint("JSON", ScriptObject.class);
+ }
+ return this.builtinJSON;
}
/**
@@ -1294,7 +1680,7 @@
*/
public static boolean isBuiltinJSON() {
final Global instance = Global.instance();
- return instance.json == instance.getBuiltinJSON();
+ return instance.json == LAZY_SENTINEL || instance.json == instance.getBuiltinJSON();
}
private ScriptObject getBuiltinJava() {
@@ -1325,8 +1711,18 @@
return instance.javax == instance.getBuiltinJavax();
}
- private ScriptObject getBuiltinJavaImporter() {
- return builtinJavaImporter;
+ private synchronized ScriptFunction getBuiltinJavaImporter() {
+ if (this.builtinJavaImporter == null) {
+ this.builtinJavaImporter = initConstructor("JavaImporter", ScriptFunction.class);
+ }
+ return this.builtinJavaImporter;
+ }
+
+ private synchronized ScriptObject getBuiltinJavaApi() {
+ if (this.builtinJavaApi == null) {
+ this.builtinJavaApi = initConstructor("Java", ScriptObject.class);
+ }
+ return this.builtinJavaApi;
}
/**
@@ -1336,11 +1732,7 @@
*/
public static boolean isBuiltinJavaImporter() {
final Global instance = Global.instance();
- return instance.javaImporter == instance.getBuiltinJavaImporter();
- }
-
- private ScriptObject getBuiltinMath() {
- return builtinMath;
+ return instance.javaImporter == LAZY_SENTINEL || instance.javaImporter == instance.getBuiltinJavaImporter();
}
/**
@@ -1350,7 +1742,7 @@
*/
public static boolean isBuiltinMath() {
final Global instance = Global.instance();
- return instance.math == instance.getBuiltinMath();
+ return instance.math == instance.builtinMath;
}
private ScriptFunction getBuiltinNumber() {
@@ -1395,7 +1787,10 @@
return instance.packages == instance.getBuiltinPackages();
}
- private ScriptFunction getBuiltinRangeError() {
+ private synchronized ScriptFunction getBuiltinRangeError() {
+ if (this.builtinRangeError == null) {
+ this.builtinRangeError = initErrorSubtype("RangeError", getErrorPrototype());
+ }
return builtinRangeError;
}
@@ -1406,10 +1801,10 @@
*/
public static boolean isBuiltinRangeError() {
final Global instance = Global.instance();
- return instance.rangeError == instance.getBuiltinRangeError();
+ return instance.rangeError == LAZY_SENTINEL || instance.rangeError == instance.getBuiltinRangeError();
}
- private ScriptFunction getBuiltinReferenceError() {
+ private synchronized ScriptFunction getBuiltinReferenceError() {
return builtinReferenceError;
}
@@ -1423,7 +1818,16 @@
return instance.referenceError == instance.getBuiltinReferenceError();
}
- private ScriptFunction getBuiltinRegExp() {
+ private synchronized ScriptFunction getBuiltinRegExp() {
+ if (this.builtinRegExp == null) {
+ this.builtinRegExp = initConstructorAndSwitchPoint("RegExp", ScriptFunction.class);
+ final ScriptObject regExpProto = ScriptFunction.getPrototype(builtinRegExp);
+ // initialize default regexp object
+ this.DEFAULT_REGEXP = new NativeRegExp("(?:)", "", this, regExpProto);
+ // RegExp.prototype should behave like a RegExp object. So copy the
+ // properties.
+ regExpProto.addBoundProperties(DEFAULT_REGEXP);
+ }
return builtinRegExp;
}
@@ -1434,7 +1838,7 @@
*/
public static boolean isBuiltinRegExp() {
final Global instance = Global.instance();
- return instance.regexp == instance.getBuiltinRegExp();
+ return instance.regexp == LAZY_SENTINEL || instance.regexp == instance.getBuiltinRegExp();
}
private ScriptFunction getBuiltinString() {
@@ -1479,8 +1883,11 @@
return instance.typeError == instance.getBuiltinTypeError();
}
- private ScriptFunction getBuiltinURIError() {
- return builtinURIError;
+ private synchronized ScriptFunction getBuiltinURIError() {
+ if (this.builtinURIError == null) {
+ this.builtinURIError = initErrorSubtype("URIError", getErrorPrototype());
+ }
+ return this.builtinURIError;
}
/**
@@ -1490,7 +1897,7 @@
*/
public static boolean isBuiltinURIError() {
final Global instance = Global.instance();
- return instance.uriError == instance.getBuiltinURIError();
+ return instance.uriError == LAZY_SENTINEL || instance.uriError == instance.getBuiltinURIError();
}
@Override
@@ -1816,6 +2223,17 @@
return invocation;
}
+ /**
+ * Adds jjs shell interactive mode builtin functions to global scope.
+ */
+ public void addShellBuiltins() {
+ Object value = ScriptFunctionImpl.makeFunction("input", ShellFunctions.INPUT);
+ addOwnProperty("input", Attribute.NOT_ENUMERABLE, value);
+
+ value = ScriptFunctionImpl.makeFunction("evalinput", ShellFunctions.EVALINPUT);
+ addOwnProperty("evalinput", Attribute.NOT_ENUMERABLE, value);
+ }
+
private synchronized SwitchPoint getLexicalScopeSwitchPoint() {
SwitchPoint switchPoint = lexicalScopeSwitchPoint;
if (switchPoint == null || switchPoint.hasBeenInvalidated()) {
@@ -1891,13 +2309,9 @@
// built-in constructors
this.builtinArray = initConstructorAndSwitchPoint("Array", ScriptFunction.class);
this.builtinBoolean = initConstructorAndSwitchPoint("Boolean", ScriptFunction.class);
- this.builtinDate = initConstructorAndSwitchPoint("Date", ScriptFunction.class);
- this.builtinJSON = initConstructorAndSwitchPoint("JSON", ScriptObject.class);
- this.builtinJSAdapter = initConstructorAndSwitchPoint("JSAdapter", ScriptFunction.class);
+ this.builtinNumber = initConstructorAndSwitchPoint("Number", ScriptFunction.class);
+ this.builtinString = initConstructorAndSwitchPoint("String", ScriptFunction.class);
this.builtinMath = initConstructorAndSwitchPoint("Math", ScriptObject.class);
- this.builtinNumber = initConstructorAndSwitchPoint("Number", ScriptFunction.class);
- this.builtinRegExp = initConstructorAndSwitchPoint("RegExp", ScriptFunction.class);
- this.builtinString = initConstructorAndSwitchPoint("String", ScriptFunction.class);
// initialize String.prototype.length to 0
// add String.prototype.length
@@ -1908,26 +2322,28 @@
final ScriptObject arrayPrototype = getArrayPrototype();
arrayPrototype.setIsArray();
- this.DEFAULT_DATE = new NativeDate(Double.NaN, this);
-
- // initialize default regexp object
- this.DEFAULT_REGEXP = new NativeRegExp("(?:)", this);
-
- // RegExp.prototype should behave like a RegExp object. So copy the
- // properties.
- final ScriptObject regExpProto = getRegExpPrototype();
- regExpProto.addBoundProperties(DEFAULT_REGEXP);
-
// Error stuff
initErrorObjects();
// java access
if (! env._no_java) {
+ this.javaApi = LAZY_SENTINEL;
+ this.javaImporter = LAZY_SENTINEL;
initJavaAccess();
}
if (! env._no_typed_arrays) {
- initTypedArray();
+ this.arrayBuffer = LAZY_SENTINEL;
+ this.dataView = LAZY_SENTINEL;
+ this.int8Array = LAZY_SENTINEL;
+ this.uint8Array = LAZY_SENTINEL;
+ this.uint8ClampedArray = LAZY_SENTINEL;
+ this.int16Array = LAZY_SENTINEL;
+ this.uint16Array = LAZY_SENTINEL;
+ this.int32Array = LAZY_SENTINEL;
+ this.uint32Array = LAZY_SENTINEL;
+ this.float32Array = LAZY_SENTINEL;
+ this.float64Array = LAZY_SENTINEL;
}
if (env._scripting) {
@@ -2001,12 +2417,9 @@
tagBuiltinProperties("Error", builtinError);
- this.builtinEvalError = initErrorSubtype("EvalError", errorProto);
- this.builtinRangeError = initErrorSubtype("RangeError", errorProto);
this.builtinReferenceError = initErrorSubtype("ReferenceError", errorProto);
this.builtinSyntaxError = initErrorSubtype("SyntaxError", errorProto);
this.builtinTypeError = initErrorSubtype("TypeError", errorProto);
- this.builtinURIError = initErrorSubtype("URIError", errorProto);
}
private ScriptFunction initErrorSubtype(final String name, final ScriptObject errorProto) {
@@ -2028,8 +2441,6 @@
this.builtinJavafx = new NativeJavaPackage("javafx", objectProto);
this.builtinJavax = new NativeJavaPackage("javax", objectProto);
this.builtinOrg = new NativeJavaPackage("org", objectProto);
- this.builtinJavaImporter = initConstructor("JavaImporter", ScriptFunction.class);
- this.builtinJavaApi = initConstructor("Java", ScriptObject.class);
}
private void initScripting(final ScriptEnvironment scriptEnv) {
@@ -2081,60 +2492,25 @@
}
}
- private void initTypedArray() {
- this.builtinArrayBuffer = initConstructorAndSwitchPoint("ArrayBuffer", ScriptFunction.class);
- this.builtinDataView = initConstructorAndSwitchPoint("DataView", ScriptFunction.class);
- this.builtinInt8Array = initConstructorAndSwitchPoint("Int8Array", ScriptFunction.class);
- this.builtinUint8Array = initConstructorAndSwitchPoint("Uint8Array", ScriptFunction.class);
- this.builtinUint8ClampedArray = initConstructorAndSwitchPoint("Uint8ClampedArray", ScriptFunction.class);
- this.builtinInt16Array = initConstructorAndSwitchPoint("Int16Array", ScriptFunction.class);
- this.builtinUint16Array = initConstructorAndSwitchPoint("Uint16Array", ScriptFunction.class);
- this.builtinInt32Array = initConstructorAndSwitchPoint("Int32Array", ScriptFunction.class);
- this.builtinUint32Array = initConstructorAndSwitchPoint("Uint32Array", ScriptFunction.class);
- this.builtinFloat32Array = initConstructorAndSwitchPoint("Float32Array", ScriptFunction.class);
- this.builtinFloat64Array = initConstructorAndSwitchPoint("Float64Array", ScriptFunction.class);
-
- }
-
private void copyBuiltins() {
this.array = this.builtinArray;
this._boolean = this.builtinBoolean;
- this.date = this.builtinDate;
this.error = this.builtinError;
- this.evalError = this.builtinEvalError;
this.function = this.builtinFunction;
- this.jsadapter = this.builtinJSAdapter;
- this.json = this.builtinJSON;
this.com = this.builtinCom;
this.edu = this.builtinEdu;
this.java = this.builtinJava;
this.javafx = this.builtinJavafx;
this.javax = this.builtinJavax;
this.org = this.builtinOrg;
- this.javaImporter = this.builtinJavaImporter;
- this.javaApi = this.builtinJavaApi;
this.math = this.builtinMath;
this.number = this.builtinNumber;
this.object = this.builtinObject;
this.packages = this.builtinPackages;
- this.rangeError = this.builtinRangeError;
this.referenceError = this.builtinReferenceError;
- this.regexp = this.builtinRegExp;
this.string = this.builtinString;
this.syntaxError = this.builtinSyntaxError;
this.typeError = this.builtinTypeError;
- this.uriError = this.builtinURIError;
- this.arrayBuffer = this.builtinArrayBuffer;
- this.dataView = this.builtinDataView;
- this.int8Array = this.builtinInt8Array;
- this.uint8Array = this.builtinUint8Array;
- this.uint8ClampedArray = this.builtinUint8ClampedArray;
- this.int16Array = this.builtinInt16Array;
- this.uint16Array = this.builtinUint16Array;
- this.int32Array = this.builtinInt32Array;
- this.uint32Array = this.builtinUint32Array;
- this.float32Array = this.builtinFloat32Array;
- this.float64Array = this.builtinFloat64Array;
}
private void initDebug() {
--- a/nashorn/test/script/nosecurity/parserapi.js.EXPECTED Thu Mar 26 13:09:11 2015 -0700
+++ b/nashorn/test/script/nosecurity/parserapi.js.EXPECTED Wed Apr 01 12:29:49 2015 -0700
@@ -1,4 +1,4 @@
-[
+[
{
"endPosition": "1113",
"kind": "COMPILATION_UNIT",
@@ -132,8 +132,8 @@
"sourceName": "parsertests/array_literal.js",
"strict": "false",
"startPosition": "1113"
-}
-,
+}
+,
{
"endPosition": "1126",
"kind": "COMPILATION_UNIT",
@@ -406,8 +406,8 @@
"sourceName": "parsertests/assignmentExpr.js",
"strict": "false",
"startPosition": "1126"
-}
-,
+}
+,
{
"endPosition": "1116",
"kind": "COMPILATION_UNIT",
@@ -912,8 +912,8 @@
"sourceName": "parsertests/binaryExpr.js",
"strict": "false",
"startPosition": "1116"
-}
-,
+}
+,
{
"endPosition": "1117",
"kind": "COMPILATION_UNIT",
@@ -959,8 +959,8 @@
"sourceName": "parsertests/block.js",
"strict": "false",
"startPosition": "1117"
-}
-,
+}
+,
{
"endPosition": "1117",
"kind": "COMPILATION_UNIT",
@@ -1060,8 +1060,8 @@
"sourceName": "parsertests/breakStat.js",
"strict": "false",
"startPosition": "1117"
-}
-,
+}
+,
{
"endPosition": "1117",
"kind": "COMPILATION_UNIT",
@@ -1098,8 +1098,8 @@
"sourceName": "parsertests/condExpr.js",
"strict": "false",
"startPosition": "1117"
-}
-,
+}
+,
{
"endPosition": "1120",
"kind": "COMPILATION_UNIT",
@@ -1199,8 +1199,8 @@
"sourceName": "parsertests/continueStat.js",
"strict": "false",
"startPosition": "1120"
-}
-,
+}
+,
{
"endPosition": "1118",
"kind": "COMPILATION_UNIT",
@@ -1214,8 +1214,8 @@
"sourceName": "parsertests/debuggerStat.js",
"strict": "false",
"startPosition": "1118"
-}
-,
+}
+,
{
"endPosition": "1137",
"kind": "COMPILATION_UNIT",
@@ -1500,8 +1500,8 @@
"sourceName": "parsertests/functions.js",
"strict": "false",
"startPosition": "1137"
-}
-,
+}
+,
{
"endPosition": "1114",
"kind": "COMPILATION_UNIT",
@@ -1604,8 +1604,8 @@
"sourceName": "parsertests/ifStat.js",
"strict": "false",
"startPosition": "1114"
-}
-,
+}
+,
{
"endPosition": "1113",
"kind": "COMPILATION_UNIT",
@@ -1668,8 +1668,8 @@
"sourceName": "parsertests/labelledStat.js",
"strict": "false",
"startPosition": "1113"
-}
-,
+}
+,
{
"endPosition": "1125",
"kind": "COMPILATION_UNIT",
@@ -2066,8 +2066,8 @@
"sourceName": "parsertests/lhsExpr.js",
"strict": "false",
"startPosition": "1125"
-}
-,
+}
+,
{
"endPosition": "1110",
"kind": "COMPILATION_UNIT",
@@ -2350,8 +2350,8 @@
"sourceName": "parsertests/loopStat.js",
"strict": "false",
"startPosition": "1110"
-}
-,
+}
+,
{
"endPosition": "1125",
"kind": "COMPILATION_UNIT",
@@ -2705,8 +2705,8 @@
"sourceName": "parsertests/objectLitExpr.js",
"strict": "false",
"startPosition": "1125"
-}
-,
+}
+,
{
"endPosition": "1118",
"kind": "COMPILATION_UNIT",
@@ -2781,8 +2781,8 @@
"sourceName": "parsertests/parenExpr.js",
"strict": "false",
"startPosition": "1118"
-}
-,
+}
+,
{
"endPosition": "1119",
"kind": "COMPILATION_UNIT",
@@ -2995,8 +2995,8 @@
"sourceName": "parsertests/primaryExpr.js",
"strict": "false",
"startPosition": "1119"
-}
-,
+}
+,
{
"endPosition": "1114",
"kind": "COMPILATION_UNIT",
@@ -3044,8 +3044,8 @@
"sourceName": "parsertests/regexp_literal.js",
"strict": "false",
"startPosition": "1114"
-}
-,
+}
+,
{
"endPosition": "1118",
"kind": "COMPILATION_UNIT",
@@ -3144,8 +3144,8 @@
"sourceName": "parsertests/returnStat.js",
"strict": "false",
"startPosition": "1118"
-}
-,
+}
+,
{
"endPosition": "1111",
"kind": "COMPILATION_UNIT",
@@ -3309,8 +3309,8 @@
"sourceName": "parsertests/switchStat.js",
"strict": "false",
"startPosition": "1111"
-}
-,
+}
+,
{
"endPosition": "1110",
"kind": "COMPILATION_UNIT",
@@ -3421,8 +3421,8 @@
"sourceName": "parsertests/throwStat.js",
"strict": "false",
"startPosition": "1110"
-}
-,
+}
+,
{
"endPosition": "1121",
"kind": "COMPILATION_UNIT",
@@ -3783,8 +3783,8 @@
"sourceName": "parsertests/tryCatchStat.js",
"strict": "false",
"startPosition": "1121"
-}
-,
+}
+,
{
"endPosition": "1115",
"kind": "COMPILATION_UNIT",
@@ -3969,8 +3969,8 @@
"sourceName": "parsertests/unaryExpr.js",
"strict": "false",
"startPosition": "1115"
-}
-,
+}
+,
{
"endPosition": "1122",
"kind": "COMPILATION_UNIT",
@@ -4016,8 +4016,8 @@
"sourceName": "parsertests/useStrict.js",
"strict": "true",
"startPosition": "1122"
-}
-,
+}
+,
{
"endPosition": "1143",
"kind": "COMPILATION_UNIT",
@@ -4092,8 +4092,8 @@
"sourceName": "parsertests/varDecl.js",
"strict": "false",
"startPosition": "1143"
-}
-,
+}
+,
{
"endPosition": "1111",
"kind": "COMPILATION_UNIT",
@@ -4142,8 +4142,8 @@
"sourceName": "parsertests/withStat.js",
"strict": "false",
"startPosition": "1111"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/caseoutofswitch.js",
"code": "case (1090, 4)",
@@ -4152,8 +4152,8 @@
"position": "1090",
"message": "parsernegativetests/caseoutofswitch.js:29:0 Expected an operand but found case\ncase 23:\n^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/caseoutofswitch.js",
"code": "default (1112, 7)",
@@ -4162,8 +4162,8 @@
"position": "1112",
"message": "parsernegativetests/caseoutofswitch.js:31:0 Expected an operand but found default\ndefault:\n^",
"lineNumber": "31"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4240,8 +4240,8 @@
"sourceName": "parsernegativetests/caseoutofswitch.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegalbreak.js",
"code": "break (1090, 5)",
@@ -4250,8 +4250,8 @@
"position": "1090",
"message": "parsernegativetests/illegalbreak.js:29:0 Illegal break statement\nbreak;\n^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegalbreak.js",
"code": "ident (1103, 3)",
@@ -4260,8 +4260,8 @@
"position": "1103",
"message": "parsernegativetests/illegalbreak.js:30:6 Undefined Label \"foo\"\nbreak foo;\n ^",
"lineNumber": "30"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4290,8 +4290,8 @@
"sourceName": "parsernegativetests/illegalbreak.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegalcontinue.js",
"code": "continue (1090, 8)",
@@ -4300,8 +4300,8 @@
"position": "1090",
"message": "parsernegativetests/illegalcontinue.js:29:0 Illegal continue statement\ncontinue;\n^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegalcontinue.js",
"code": "ident (1109, 3)",
@@ -4310,8 +4310,8 @@
"position": "1109",
"message": "parsernegativetests/illegalcontinue.js:30:9 Undefined Label \"foo\"\ncontinue foo;\n ^",
"lineNumber": "30"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4340,8 +4340,8 @@
"sourceName": "parsernegativetests/illegalcontinue.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegallvalue.js",
"code": "decimal (1090, 2)",
@@ -4350,8 +4350,8 @@
"position": "1090",
"message": "parsernegativetests/illegallvalue.js:29:0 Invalid left hand side for assignment\n44 = 54;\n^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegallvalue.js",
"code": "decimal (1099, 3)",
@@ -4360,8 +4360,8 @@
"position": "1099",
"message": "parsernegativetests/illegallvalue.js:30:0 Invalid left hand side for assignment\n233 += 33;\n^",
"lineNumber": "30"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegallvalue.js",
"code": "decimal (1110, 4)",
@@ -4370,8 +4370,8 @@
"position": "1110",
"message": "parsernegativetests/illegallvalue.js:31:0 Invalid left hand side for assignment\n3423 -= 234;\n^",
"lineNumber": "31"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4410,8 +4410,8 @@
"sourceName": "parsernegativetests/illegallvalue.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/illegaloperator.js",
"code": "* (1093, 1)",
@@ -4420,8 +4420,8 @@
"position": "1093",
"message": "parsernegativetests/illegaloperator.js:29:3 Expected an operand but found *\nx ** y\n ^",
"lineNumber": "29"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4440,8 +4440,8 @@
"sourceName": "parsernegativetests/illegaloperator.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/keywordident.js",
"code": "var (1094, 3)",
@@ -4450,8 +4450,8 @@
"position": "1094",
"message": "parsernegativetests/keywordident.js:29:4 Expected ident but found var\nvar var = 23;\n ^",
"lineNumber": "29"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4482,8 +4482,8 @@
"sourceName": "parsernegativetests/keywordident.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/parenmissing.js",
"code": "; (1096, 1)",
@@ -4492,8 +4492,8 @@
"position": "1096",
"message": "parsernegativetests/parenmissing.js:29:6 Expected ) but found ;\n(1 + 2;\n ^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/parenmissing.js",
"code": ") (1103, 1)",
@@ -4502,8 +4502,8 @@
"position": "1103",
"message": "parsernegativetests/parenmissing.js:30:5 Expected ; but found )\nx * y);\n ^",
"lineNumber": "30"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4554,8 +4554,8 @@
"sourceName": "parsernegativetests/parenmissing.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/repeatedproperty.js",
"code": "ident (1111, 3)",
@@ -4564,8 +4564,8 @@
"position": "1111",
"message": "parsernegativetests/repeatedproperty.js:29:21 Property \"foo\" already defined\nvar obj = { foo: 34, get foo() { return 'hello' } };\n ^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/repeatedproperty.js",
"code": "ident (1165, 3)",
@@ -4574,8 +4574,8 @@
"position": "1165",
"message": "parsernegativetests/repeatedproperty.js:30:22 Property \"foo\" already defined\nvar obj1 = { foo: 34, set foo(x) { } };\n ^",
"lineNumber": "30"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/repeatedproperty.js",
"code": "ident (1205, 3)",
@@ -4584,8 +4584,8 @@
"position": "1205",
"message": "parsernegativetests/repeatedproperty.js:31:22 Property \"foo\" already defined\nvar obj2 = { foo: 34, set foo(x) { } };\n ^",
"lineNumber": "31"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/repeatedproperty.js",
"code": "ident (1251, 3)",
@@ -4594,8 +4594,8 @@
"position": "1251",
"message": "parsernegativetests/repeatedproperty.js:32:28 Property \"bar\" already defined\nvar obj3 = { get bar() { }, get bar() {} };\n ^",
"lineNumber": "32"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/repeatedproperty.js",
"code": "ident (1296, 3)",
@@ -4604,8 +4604,8 @@
"position": "1296",
"message": "parsernegativetests/repeatedproperty.js:33:29 Property \"bar\" already defined\nvar obj4 = { set bar(x) { }, set bar(x) {} };\n ^",
"lineNumber": "33"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4664,8 +4664,8 @@
"sourceName": "parsernegativetests/repeatedproperty.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/strict_repeatedproperty.js",
"code": "ident (1126, 3)",
@@ -4674,8 +4674,8 @@
"position": "1126",
"message": "parsernegativetests/strict_repeatedproperty.js:31:21 Property \"foo\" already defined\nvar obj = { foo: 34, foo: 'hello' };\n ^",
"lineNumber": "31"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4705,8 +4705,8 @@
"sourceName": "parsernegativetests/strict_repeatedproperty.js",
"strict": "true",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/strict_repeatparam.js",
"code": "ident (1119, 1)",
@@ -4715,8 +4715,8 @@
"position": "1119",
"message": "parsernegativetests/strict_repeatparam.js:31:14 strict mode function cannot have duplicate parameter name \"x\"\nfunction func(x, x) {}\n ^",
"lineNumber": "31"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4746,8 +4746,8 @@
"sourceName": "parsernegativetests/strict_repeatparam.js",
"strict": "true",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/strict_with.js",
"code": "with (1105, 4)",
@@ -4756,8 +4756,8 @@
"position": "1105",
"message": "parsernegativetests/strict_with.js:31:0 \"with\" statement cannot be used in strict mode\nwith({}) {}\n^",
"lineNumber": "31"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/strict_with.js",
"code": ") (1112, 1)",
@@ -4766,8 +4766,8 @@
"position": "1112",
"message": "parsernegativetests/strict_with.js:31:7 Expected ; but found )\nwith({}) {}\n ^",
"lineNumber": "31"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4807,8 +4807,8 @@
"sourceName": "parsernegativetests/strict_with.js",
"strict": "true",
"startPosition": "1090"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/toplevelreturn.js",
"code": "return (1090, 6)",
@@ -4817,8 +4817,8 @@
"position": "1090",
"message": "parsernegativetests/toplevelreturn.js:29:0 Invalid return statement\nreturn;\n^",
"lineNumber": "29"
-}
-,
+}
+,
{
"fileName": "parsernegativetests/toplevelreturn.js",
"code": "return (1098, 6)",
@@ -4827,8 +4827,8 @@
"position": "1098",
"message": "parsernegativetests/toplevelreturn.js:30:0 Invalid return statement\nreturn 23;\n^",
"lineNumber": "30"
-}
-,
+}
+,
{
"endPosition": "1090",
"kind": "COMPILATION_UNIT",
@@ -4857,8 +4857,8 @@
"sourceName": "parsernegativetests/toplevelreturn.js",
"strict": "false",
"startPosition": "1090"
-}
-,
+}
+,
{
"endPosition": "1136",
"kind": "COMPILATION_UNIT",
@@ -6189,11 +6189,11 @@
"startPosition": "1972"
},
{
- "endPosition": "3598",
+ "endPosition": "3618",
"kind": "FUNCTION",
"name": "processFiles",
"body": {
- "endPosition": "3555",
+ "endPosition": "3575",
"kind": "BLOCK",
"statements": [
{
@@ -6335,7 +6335,7 @@
"name": "files",
"startPosition": "3053"
},
- "endPosition": "3555",
+ "endPosition": "3575",
"kind": "FOR_IN_LOOP",
"forEach": "true",
"variable": {
@@ -6345,7 +6345,7 @@
"startPosition": "3045"
},
"statement": {
- "endPosition": "3555",
+ "endPosition": "3575",
"kind": "BLOCK",
"statements": [
{
@@ -6380,11 +6380,11 @@
],
"startPosition": "3073"
},
- "endPosition": "3550",
+ "endPosition": "3570",
"kind": "IF",
"startPosition": "3069",
"thenStatement": {
- "endPosition": "3550",
+ "endPosition": "3570",
"kind": "BLOCK",
"statements": [
{
@@ -6436,12 +6436,12 @@
}
},
{
- "endPosition": "3415",
+ "endPosition": "3435",
"kind": "VARIABLE",
"name": "tree",
"startPosition": "3196",
"initializer": {
- "endPosition": "3415",
+ "endPosition": "3435",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
"identifier": "parse",
@@ -6500,12 +6500,12 @@
"endPosition": "3286",
"kind": "FUNCTION_EXPRESSION",
"body": {
- "endPosition": "3397",
+ "endPosition": "3417",
"kind": "BLOCK",
"statements": [
{
"expression": {
- "endPosition": "3365",
+ "endPosition": "3385",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
"endPosition": "3312",
@@ -6515,90 +6515,116 @@
},
"arguments": [
{
- "endPosition": "3364",
+ "endPosition": "3384",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "identifier": "stringify",
+ "identifier": "replace",
"expression": {
- "endPosition": "3317",
- "kind": "IDENTIFIER",
- "name": "JSON",
+ "endPosition": "3364",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "stringify",
+ "expression": {
+ "endPosition": "3317",
+ "kind": "IDENTIFIER",
+ "name": "JSON",
+ "startPosition": "3313"
+ },
+ "endPosition": "3327",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3313"
+ },
+ "arguments": [
+ {
+ "endPosition": "3354",
+ "kind": "FUNCTION_INVOCATION",
+ "functionSelect": {
+ "identifier": "convert",
+ "expression": {
+ "endPosition": "3334",
+ "kind": "IDENTIFIER",
+ "name": "parser",
+ "startPosition": "3328"
+ },
+ "endPosition": "3342",
+ "kind": "MEMBER_SELECT",
+ "startPosition": "3328"
+ },
+ "arguments": [
+ {
+ "endPosition": "3353",
+ "kind": "IDENTIFIER",
+ "name": "diagnostic",
+ "startPosition": "3343"
+ }
+ ],
+ "startPosition": "3328"
+ },
+ {
+ "endPosition": "3360",
+ "kind": "NULL_LITERAL",
+ "startPosition": "3356"
+ },
+ {
+ "endPosition": "3363",
+ "kind": "NUMBER_LITERAL",
+ "value": "2",
+ "startPosition": "3362"
+ }
+ ],
"startPosition": "3313"
},
- "endPosition": "3327",
+ "endPosition": "3372",
"kind": "MEMBER_SELECT",
"startPosition": "3313"
},
"arguments": [
{
- "endPosition": "3354",
- "kind": "FUNCTION_INVOCATION",
- "functionSelect": {
- "identifier": "convert",
- "expression": {
- "endPosition": "3334",
- "kind": "IDENTIFIER",
- "name": "parser",
- "startPosition": "3328"
- },
- "endPosition": "3342",
- "kind": "MEMBER_SELECT",
- "startPosition": "3328"
- },
- "arguments": [
- {
- "endPosition": "3353",
- "kind": "IDENTIFIER",
- "name": "diagnostic",
- "startPosition": "3343"
- }
- ],
- "startPosition": "3328"
+ "endPosition": "3379",
+ "kind": "REGEXP_LITERAL",
+ "options": "g",
+ "pattern": "\\\\r",
+ "startPosition": "3373"
},
{
- "endPosition": "3360",
- "kind": "NULL_LITERAL",
- "startPosition": "3356"
- },
- {
- "endPosition": "3363",
- "kind": "NUMBER_LITERAL",
- "value": "2",
- "startPosition": "3362"
+ "endPosition": "3382",
+ "kind": "STRING_LITERAL",
+ "value": "",
+ "startPosition": "3382"
}
],
- "startPosition": "3313"
+ "startPosition": "3372"
}
],
"startPosition": "3307"
},
- "endPosition": "3365",
+ "endPosition": "3385",
"kind": "EXPRESSION_STATEMENT",
"startPosition": "3307"
},
{
"expression": {
- "endPosition": "3396",
+ "endPosition": "3416",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3391",
+ "endPosition": "3411",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3386"
+ "startPosition": "3406"
},
"arguments": [
{
- "endPosition": "3394",
+ "endPosition": "3414",
"kind": "STRING_LITERAL",
"value": ",",
- "startPosition": "3393"
+ "startPosition": "3413"
}
],
- "startPosition": "3386"
+ "startPosition": "3406"
},
- "endPosition": "3396",
+ "endPosition": "3416",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3386"
+ "startPosition": "3406"
}
],
"startPosition": "3286"
@@ -6621,107 +6647,107 @@
{
"condition": {
"leftOperand": {
- "endPosition": "3437",
+ "endPosition": "3457",
"kind": "IDENTIFIER",
"name": "tree",
- "startPosition": "3433"
+ "startPosition": "3453"
},
- "endPosition": "3445",
+ "endPosition": "3465",
"kind": "NOT_EQUAL_TO",
"rightOperand": {
- "endPosition": "3445",
+ "endPosition": "3465",
"kind": "NULL_LITERAL",
- "startPosition": "3441"
+ "startPosition": "3461"
},
- "startPosition": "3433"
+ "startPosition": "3453"
},
- "endPosition": "3541",
+ "endPosition": "3561",
"kind": "IF",
- "startPosition": "3429",
+ "startPosition": "3449",
"thenStatement": {
- "endPosition": "3541",
+ "endPosition": "3561",
"kind": "BLOCK",
"statements": [
{
"expression": {
- "endPosition": "3500",
+ "endPosition": "3520",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3469",
+ "endPosition": "3489",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3464"
+ "startPosition": "3484"
},
"arguments": [
{
- "endPosition": "3499",
+ "endPosition": "3519",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
"identifier": "stringify",
"expression": {
- "endPosition": "3474",
+ "endPosition": "3494",
"kind": "IDENTIFIER",
"name": "JSON",
- "startPosition": "3470"
+ "startPosition": "3490"
},
- "endPosition": "3484",
+ "endPosition": "3504",
"kind": "MEMBER_SELECT",
- "startPosition": "3470"
+ "startPosition": "3490"
},
"arguments": [
{
- "endPosition": "3489",
+ "endPosition": "3509",
"kind": "IDENTIFIER",
"name": "tree",
- "startPosition": "3485"
+ "startPosition": "3505"
},
{
- "endPosition": "3495",
+ "endPosition": "3515",
"kind": "NULL_LITERAL",
- "startPosition": "3491"
+ "startPosition": "3511"
},
{
- "endPosition": "3498",
+ "endPosition": "3518",
"kind": "NUMBER_LITERAL",
"value": "2",
- "startPosition": "3497"
+ "startPosition": "3517"
}
],
- "startPosition": "3470"
+ "startPosition": "3490"
}
],
- "startPosition": "3464"
+ "startPosition": "3484"
},
- "endPosition": "3500",
+ "endPosition": "3520",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3464"
+ "startPosition": "3484"
},
{
"expression": {
- "endPosition": "3527",
+ "endPosition": "3547",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3522",
+ "endPosition": "3542",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3517"
+ "startPosition": "3537"
},
"arguments": [
{
- "endPosition": "3525",
+ "endPosition": "3545",
"kind": "STRING_LITERAL",
"value": ",",
- "startPosition": "3524"
+ "startPosition": "3544"
}
],
- "startPosition": "3517"
+ "startPosition": "3537"
},
- "endPosition": "3527",
+ "endPosition": "3547",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3517"
+ "startPosition": "3537"
}
],
- "startPosition": "3447"
+ "startPosition": "3467"
}
}
],
@@ -6748,268 +6774,268 @@
]
},
{
- "endPosition": "3901",
+ "endPosition": "3921",
"kind": "FUNCTION",
"name": "main",
"body": {
- "endPosition": "3899",
+ "endPosition": "3919",
"kind": "BLOCK",
"statements": [
{
"expression": {
- "endPosition": "3631",
+ "endPosition": "3651",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3626",
+ "endPosition": "3646",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3621"
+ "startPosition": "3641"
},
"arguments": [
{
- "endPosition": "3629",
+ "endPosition": "3649",
"kind": "STRING_LITERAL",
"value": "[",
- "startPosition": "3628"
+ "startPosition": "3648"
}
],
- "startPosition": "3621"
+ "startPosition": "3641"
},
- "endPosition": "3631",
+ "endPosition": "3651",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3621"
+ "startPosition": "3641"
},
{
"expression": {
- "endPosition": "3665",
+ "endPosition": "3685",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3650",
+ "endPosition": "3670",
"kind": "IDENTIFIER",
"name": "processFiles",
- "startPosition": "3638"
+ "startPosition": "3658"
},
"arguments": [
{
- "endPosition": "3663",
+ "endPosition": "3683",
"kind": "STRING_LITERAL",
"value": "parsertests",
- "startPosition": "3652"
+ "startPosition": "3672"
}
],
- "startPosition": "3638"
+ "startPosition": "3658"
},
- "endPosition": "3665",
+ "endPosition": "3685",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3638"
+ "startPosition": "3658"
},
{
"expression": {
- "endPosition": "3706",
+ "endPosition": "3726",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3683",
+ "endPosition": "3703",
"kind": "IDENTIFIER",
"name": "processFiles",
- "startPosition": "3671"
+ "startPosition": "3691"
},
"arguments": [
{
- "endPosition": "3704",
+ "endPosition": "3724",
"kind": "STRING_LITERAL",
"value": "parsernegativetests",
- "startPosition": "3685"
+ "startPosition": "3705"
}
],
- "startPosition": "3671"
+ "startPosition": "3691"
},
- "endPosition": "3706",
+ "endPosition": "3726",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3671"
+ "startPosition": "3691"
},
{
- "endPosition": "3775",
+ "endPosition": "3795",
"kind": "VARIABLE",
"name": "script",
- "startPosition": "3747",
+ "startPosition": "3767",
"initializer": {
- "endPosition": "3775",
+ "endPosition": "3795",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3765",
+ "endPosition": "3785",
"kind": "IDENTIFIER",
"name": "readFully",
- "startPosition": "3756"
+ "startPosition": "3776"
},
"arguments": [
{
- "endPosition": "3774",
+ "endPosition": "3794",
"kind": "IDENTIFIER",
"name": "__FILE__",
- "startPosition": "3766"
+ "startPosition": "3786"
}
],
- "startPosition": "3756"
+ "startPosition": "3776"
}
},
{
- "endPosition": "3840",
+ "endPosition": "3860",
"kind": "VARIABLE",
"name": "tree",
- "startPosition": "3785",
+ "startPosition": "3805",
"initializer": {
- "endPosition": "3840",
+ "endPosition": "3860",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
"identifier": "parse",
"expression": {
"constructorExpression": {
- "endPosition": "3804",
+ "endPosition": "3824",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3802",
+ "endPosition": "3822",
"kind": "IDENTIFIER",
"name": "Parser",
- "startPosition": "3796"
+ "startPosition": "3816"
},
"arguments": [],
- "startPosition": "3796"
+ "startPosition": "3816"
},
- "endPosition": "3804",
+ "endPosition": "3824",
"kind": "NEW",
- "startPosition": "3792"
+ "startPosition": "3812"
},
- "endPosition": "3810",
+ "endPosition": "3830",
"kind": "MEMBER_SELECT",
- "startPosition": "3792"
+ "startPosition": "3812"
},
"arguments": [
{
- "endPosition": "3824",
+ "endPosition": "3844",
"kind": "STRING_LITERAL",
"value": "parserapi.js",
- "startPosition": "3812"
+ "startPosition": "3832"
},
{
- "endPosition": "3833",
+ "endPosition": "3853",
"kind": "IDENTIFIER",
"name": "script",
- "startPosition": "3827"
+ "startPosition": "3847"
},
{
- "endPosition": "3839",
+ "endPosition": "3859",
"kind": "NULL_LITERAL",
- "startPosition": "3835"
+ "startPosition": "3855"
}
],
- "startPosition": "3792"
+ "startPosition": "3812"
}
},
{
"expression": {
- "endPosition": "3882",
+ "endPosition": "3902",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3851",
+ "endPosition": "3871",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3846"
+ "startPosition": "3866"
},
"arguments": [
{
- "endPosition": "3881",
+ "endPosition": "3901",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
"identifier": "stringify",
"expression": {
- "endPosition": "3856",
+ "endPosition": "3876",
"kind": "IDENTIFIER",
"name": "JSON",
- "startPosition": "3852"
+ "startPosition": "3872"
},
- "endPosition": "3866",
+ "endPosition": "3886",
"kind": "MEMBER_SELECT",
- "startPosition": "3852"
+ "startPosition": "3872"
},
"arguments": [
{
- "endPosition": "3871",
+ "endPosition": "3891",
"kind": "IDENTIFIER",
"name": "tree",
- "startPosition": "3867"
+ "startPosition": "3887"
},
{
- "endPosition": "3877",
+ "endPosition": "3897",
"kind": "NULL_LITERAL",
- "startPosition": "3873"
+ "startPosition": "3893"
},
{
- "endPosition": "3880",
+ "endPosition": "3900",
"kind": "NUMBER_LITERAL",
"value": "2",
- "startPosition": "3879"
+ "startPosition": "3899"
}
],
- "startPosition": "3852"
+ "startPosition": "3872"
}
],
- "startPosition": "3846"
+ "startPosition": "3866"
},
- "endPosition": "3882",
+ "endPosition": "3902",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3846"
+ "startPosition": "3866"
},
{
"expression": {
- "endPosition": "3898",
+ "endPosition": "3918",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3893",
+ "endPosition": "3913",
"kind": "IDENTIFIER",
"name": "print",
- "startPosition": "3888"
+ "startPosition": "3908"
},
"arguments": [
{
- "endPosition": "3896",
+ "endPosition": "3916",
"kind": "STRING_LITERAL",
"value": "]",
- "startPosition": "3895"
+ "startPosition": "3915"
}
],
- "startPosition": "3888"
+ "startPosition": "3908"
},
- "endPosition": "3898",
+ "endPosition": "3918",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3888"
+ "startPosition": "3908"
}
],
- "startPosition": "3615"
+ "startPosition": "3635"
},
"strict": "false",
- "startPosition": "3599",
+ "startPosition": "3619",
"parameters": []
},
{
"expression": {
- "endPosition": "3909",
+ "endPosition": "3929",
"kind": "FUNCTION_INVOCATION",
"functionSelect": {
- "endPosition": "3907",
+ "endPosition": "3927",
"kind": "IDENTIFIER",
"name": "main",
- "startPosition": "3903"
+ "startPosition": "3923"
},
"arguments": [],
- "startPosition": "3903"
- },
- "endPosition": "3909",
+ "startPosition": "3923"
+ },
+ "endPosition": "3929",
"kind": "EXPRESSION_STATEMENT",
- "startPosition": "3903"
+ "startPosition": "3923"
}
],
"sourceName": "parserapi.js",
"strict": "false",
"startPosition": "1136"
-}
-]
+}
+]