Java Code Examples for jdk.nashorn.internal.runtime.Undefined#getUndefined()
The following examples show how to use
jdk.nashorn.internal.runtime.Undefined#getUndefined() .
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: NativeSymbol.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 6 19.4.1.1 Symbol ( [ description ] ) * * @param newObj is this function invoked with the new operator * @param self self reference * @param args arguments * @return new symbol value */ @Constructor(arity = 1) public static Object constructor(final boolean newObj, final Object self, final Object... args) { if (newObj) { throw typeError("symbol.as.constructor"); } final String description = args.length > 0 && args[0] != Undefined.getUndefined() ? JSType.toString(args[0]) : ""; return new Symbol(description); }
Example 2
Source File: NativeSymbol.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ES6 19.4.2.5 Symbol.keyFor ( sym ) * * @param self self reference * @param arg the argument * @return the symbol name */ @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR) public synchronized static Object keyFor(final Object self, final Object arg) { if (!(arg instanceof Symbol)) { throw typeError("not.a.symbol", ScriptRuntime.safeToString(arg)); } final String name = ((Symbol) arg).getName(); return globalSymbolRegistry.get(name) == arg ? name : Undefined.getUndefined(); }
Example 3
Source File: NativeWeakSet.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void populateWeakSet(final Map<Object, Boolean> set, final Object arg, final Global global) { if (arg != null && arg != Undefined.getUndefined()) { AbstractIterator.iterate(arg, global, value -> { set.put(checkKey(value), Boolean.TRUE); }); } }
Example 4
Source File: NativeMap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void populateMap(final LinkedMap map, final Object arg, final Global global) { if (arg != null && arg != Undefined.getUndefined()) { AbstractIterator.iterate(arg, global, value -> { if (JSType.isPrimitive(value)) { throw typeError(global, "not.an.object", ScriptRuntime.safeToString(value)); } if (value instanceof ScriptObject) { final ScriptObject sobj = (ScriptObject) value; map.set(convertKey(sobj.get(0)), sobj.get(1)); } }); } }
Example 5
Source File: NativeWeakMap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ECMA6 23.3.3.3 WeakMap.prototype.get ( key ) * * @param self the self reference * @param key the key * @return the associated value or undefined */ @Function(attributes = Attribute.NOT_ENUMERABLE) public static Object get(final Object self, final Object key) { final NativeWeakMap map = getMap(self); if (isPrimitive(key)) { return Undefined.getUndefined(); } return map.jmap.get(key); }
Example 6
Source File: NativeWeakMap.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static void populateMap(final Map<Object, Object> map, final Object arg, final Global global) { // This method is similar to NativeMap.populateMap, but it uses a different // map implementation and the checking/conversion of keys differs as well. if (arg != null && arg != Undefined.getUndefined()) { AbstractIterator.iterate(arg, global, value -> { if (isPrimitive(value)) { throw typeError(global, "not.an.object", ScriptRuntime.safeToString(value)); } if (value instanceof ScriptObject) { final ScriptObject sobj = (ScriptObject) value; map.put(checkKey(sobj.get(0)), sobj.get(1)); } }); } }
Example 7
Source File: ObjectClassGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 8
Source File: ObjectClassGenerator.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 9
Source File: ObjectClassGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 10
Source File: ObjectClassGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 11
Source File: NativeSet.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static void populateSet(final LinkedMap map, final Object arg, final Global global) { if (arg != null && arg != Undefined.getUndefined()) { AbstractIterator.iterate(arg, global, value -> map.set(convertKey(value), null)); } }
Example 12
Source File: ObjectClassGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 13
Source File: ObjectClassGenerator.java From hottub with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 14
Source File: ObjectClassGenerator.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("unused") private static Object getDifferentUndefined(final int programPoint) { throw new UnwarrantedOptimismException(Undefined.getUndefined(), programPoint); }
Example 15
Source File: LinkedMap.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Get the value associated with {@code key}. * @param key the key * @return the associated value, or {@code null} if {@code key} is not contained in the map */ public Object get(final Object key) { final Node node = data.get(key); return node == null ? Undefined.getUndefined() : node.getValue(); }