Java Code Examples for jdk.nashorn.internal.objects.Global#isLocationPropertyPlaceholder()
The following examples show how to use
jdk.nashorn.internal.objects.Global#isLocationPropertyPlaceholder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptRuntime.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }
Example 2
Source File: ScriptRuntime.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }
Example 3
Source File: ScriptRuntime.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }
Example 4
Source File: ScriptRuntime.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }
Example 5
Source File: ScriptRuntime.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }
Example 6
Source File: ScriptRuntime.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * ECMA 11.4.3 The typeof Operator - generic implementation * * @param object the object from which to retrieve property to type check * @param property property in object to check * * @return type name */ public static Object TYPEOF(final Object object, final Object property) { Object obj = object; if (property != null) { if (obj instanceof ScriptObject) { obj = ((ScriptObject)obj).get(property); if(Global.isLocationPropertyPlaceholder(obj)) { if(CompilerConstants.__LINE__.name().equals(property)) { obj = Integer.valueOf(0); } else { obj = ""; } } } else if (object instanceof Undefined) { obj = ((Undefined)obj).get(property); } else if (object == null) { throw typeError("cant.get.property", safeToString(property), "null"); } else if (JSType.isPrimitive(obj)) { obj = ((ScriptObject)JSType.toScriptObject(obj)).get(property); } else if (obj instanceof JSObject) { obj = ((JSObject)obj).getMember(property.toString()); } else { obj = UNDEFINED; } } return JSType.of(obj).typeName(); }