jdk.nashorn.internal.runtime.GlobalObject Java Examples
The following examples show how to use
jdk.nashorn.internal.runtime.GlobalObject.
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: NashornScriptEngine.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void setContextVariables(final ScriptObject ctxtGlobal, final ScriptContext ctxt) { // set "context" global variable via contextProperty - because this // property is non-writable contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false); Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal); if (args == null || args == UNDEFINED) { args = ScriptRuntime.EMPTY_ARRAY; } // if no arguments passed, expose it if (! (args instanceof ScriptObject)) { args = ((GlobalObject)ctxtGlobal).wrapAsObject(args); ctxtGlobal.set("arguments", args, false); } }
Example #2
Source File: NashornPrimitiveLinker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public GuardedInvocation getGuardedInvocation(final LinkRequest origRequest, final LinkerServices linkerServices) throws Exception { final LinkRequest request = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context final Object self = request.getReceiver(); final GlobalObject global = (GlobalObject) Context.getGlobal(); final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor) request.getCallSiteDescriptor(); return Bootstrap.asType(global.primitiveLookup(request, self), linkerServices, desc); }
Example #3
Source File: NashornScriptEngine.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) { ScriptObject sobj = mirror.getScriptObject(); if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) { return sobj; } return null; }
Example #4
Source File: NashornPrimitiveLinker.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public GuardedInvocation getGuardedInvocation(final LinkRequest origRequest, final LinkerServices linkerServices) throws Exception { final LinkRequest request = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context final Object self = request.getReceiver(); final GlobalObject global = (GlobalObject) Context.getGlobal(); final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor) request.getCallSiteDescriptor(); return Bootstrap.asType(global.primitiveLookup(request, self), linkerServices, desc); }
Example #5
Source File: NashornScriptEngine.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) { ScriptObject sobj = mirror.getScriptObject(); if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) { return sobj; } return null; }
Example #6
Source File: NashornScriptEngine.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void setContextVariables(final ScriptObject ctxtGlobal, final ScriptContext ctxt) { // set "context" global variable via contextProperty - because this // property is non-writable contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false); Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal); if (args == null || args == UNDEFINED) { args = ScriptRuntime.EMPTY_ARRAY; } // if no arguments passed, expose it if (! (args instanceof ScriptObject)) { args = ((GlobalObject)ctxtGlobal).wrapAsObject(args); ctxtGlobal.set("arguments", args, false); } }
Example #7
Source File: NashornPrimitiveLinker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public GuardedInvocation getGuardedInvocation(final LinkRequest origRequest, final LinkerServices linkerServices) throws Exception { final LinkRequest request = origRequest.withoutRuntimeContext(); // Nashorn has no runtime context final Object self = request.getReceiver(); final GlobalObject global = (GlobalObject) Context.getGlobal(); final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor) request.getCallSiteDescriptor(); return Bootstrap.asType(global.primitiveLookup(request, self), linkerServices, desc); }
Example #8
Source File: NashornScriptEngine.java From nashorn with GNU General Public License v2.0 | 5 votes |
private void setContextVariables(final ScriptObject ctxtGlobal, final ScriptContext ctxt) { // set "context" global variable via contextProperty - because this // property is non-writable contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false); Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal); if (args == null || args == UNDEFINED) { args = ScriptRuntime.EMPTY_ARRAY; } // if no arguments passed, expose it if (! (args instanceof ScriptObject)) { args = ((GlobalObject)ctxtGlobal).wrapAsObject(args); ctxtGlobal.set("arguments", args, false); } }
Example #9
Source File: NashornScriptEngine.java From nashorn with GNU General Public License v2.0 | 5 votes |
private ScriptObject globalFromMirror(final ScriptObjectMirror mirror) { ScriptObject sobj = mirror.getScriptObject(); if (sobj instanceof GlobalObject && isOfContext(sobj, nashornContext)) { return sobj; } return null; }
Example #10
Source File: SealedArrayFilter.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example #11
Source File: FrozenArrayFilter.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example #12
Source File: SealedArrayFilter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example #13
Source File: FrozenArrayFilter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example #14
Source File: SealedArrayFilter.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example #15
Source File: FrozenArrayFilter.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example #16
Source File: ArrayData.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), true, true, true); }
Example #17
Source File: ArrayData.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), true, true, true); }
Example #18
Source File: ArrayData.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ public PropertyDescriptor getDescriptor(final GlobalObject global, final int index) { return global.newDataDescriptor(getObject(index), true, true, true); }