Package org.htmlunit.corejs.javascript
Class InterpretedFunction
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.IdScriptableObject
org.htmlunit.corejs.javascript.BaseFunction
org.htmlunit.corejs.javascript.NativeFunction
org.htmlunit.corejs.javascript.InterpretedFunction
- All Implemented Interfaces:
Serializable
,Callable
,ConstProperties
,Constructable
,DebuggableObject
,Function
,IdFunctionCall
,Script
,Scriptable
,SymbolScriptable
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Arguments
(package private) InterpreterData
(package private) SecurityController
(package private) Object
private static final long
Fields inherited from class org.htmlunit.corejs.javascript.BaseFunction
GENERATOR_FUNCTION_CLASS, Id_arguments, Id_arity, Id_length, Id_name, Id_prototype, MAX_INSTANCE_ID
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
InterpretedFunction
(InterpretedFunction parent, int index) private
InterpretedFunction
(InterpreterData idata, Object staticSecurityDomain) -
Method Summary
Modifier and TypeMethodDescriptioncall
(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) Calls the function.(package private) static InterpretedFunction
createFunction
(Context cx, Scriptable scope, InterpretedFunction parent, int index) Create function embedded in script or another function.(package private) static InterpretedFunction
createFunction
(Context cx, Scriptable scope, InterpreterData idata, Object staticSecurityDomain) Create function compiled from Function(...) constructor.(package private) static InterpretedFunction
createScript
(InterpreterData idata, Object staticSecurityDomain) Create script from compiled bytecode.exec
(Context cx, Scriptable scope) Execute the script.get
(String name, Scriptable start) Returns the value of the named property or NOT_FOUND.Get encoded source string.protected int
protected int
Get number of declared parameters and variables defined through var statements.protected int
Get number of declared parameters.protected boolean
getParamOrVarConst
(int index) Get parameter or variable const-ness.protected String
getParamOrVarName
(int index) Get parameter or variable name.(package private) boolean
hasFunctionNamed
(String name) boolean
isScript()
resumeGenerator
(Context cx, Scriptable scope, int operation, Object state, Object value) Resume execution of a suspended generator.(package private) void
setArguments
(Arguments arguments) toString()
Provides the decompiled source of the function what is helpful while debugging.Methods inherited from class org.htmlunit.corejs.javascript.NativeFunction
decompile, getArity, getLength, initScriptFunction, initScriptFunction, jsGet_name
Methods inherited from class org.htmlunit.corejs.javascript.BaseFunction
construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getClassName, getClassPrototype, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, init, init, initAsGeneratorFunction, initPrototypeId, isApply, isApplyOrCall, isGeneratorFunction, setImmunePrototypeProperty, setInstanceIdAttributes, setInstanceIdValue, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototype
Methods inherited from class org.htmlunit.corejs.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, findPrototypeId, get, getAttributes, getAttributes, getIds, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getBase, getBase, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putImpl, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable
delete, delete, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
idata
InterpreterData idata -
securityController
SecurityController securityController -
securityDomain
Object securityDomain -
arguments
-
-
Constructor Details
-
InterpretedFunction
-
InterpretedFunction
-
-
Method Details
-
createScript
Create script from compiled bytecode. -
createFunction
static InterpretedFunction createFunction(Context cx, Scriptable scope, InterpreterData idata, Object staticSecurityDomain) Create function compiled from Function(...) constructor. -
createFunction
static InterpretedFunction createFunction(Context cx, Scriptable scope, InterpretedFunction parent, int index) Create function embedded in script or another function. -
getFunctionName
- Overrides:
getFunctionName
in classBaseFunction
-
call
Calls the function.- Specified by:
call
in interfaceCallable
- Specified by:
call
in interfaceFunction
- Overrides:
call
in classBaseFunction
- Parameters:
cx
- the current contextscope
- the scope used for the callthisObj
- the value of "this"args
- function arguments. Must not be null. You can useScriptRuntime.emptyArgs
to pass empty arguments.- Returns:
- the result of the function call.
-
exec
Description copied from interface:Script
Execute the script.The script is executed in a particular runtime Context, which must be associated with the current thread. The script is executed relative to a scope--definitions and uses of global top-level variables and functions will access properties of the scope object. For compliant ECMA programs, the scope must be an object that has been initialized as a global object using
Context.initStandardObjects
. -
isScript
public boolean isScript() -
getEncodedSource
Description copied from class:NativeFunction
Get encoded source string.- Overrides:
getEncodedSource
in classNativeFunction
-
getDebuggableView
- Overrides:
getDebuggableView
in classNativeFunction
-
resumeGenerator
public Object resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value) Description copied from class:NativeFunction
Resume execution of a suspended generator.- Overrides:
resumeGenerator
in classNativeFunction
- Parameters:
cx
- The current contextscope
- Scope for the parent generator functionoperation
- The resumption operation (next, send, etc.. )state
- The generator state (has locals, stack, etc.)value
- The return value of yield (if required).- Returns:
- The next yielded value (if any)
-
getLanguageVersion
protected int getLanguageVersion()- Specified by:
getLanguageVersion
in classNativeFunction
-
getParamCount
protected int getParamCount()Description copied from class:NativeFunction
Get number of declared parameters. It should be 0 for scripts.- Specified by:
getParamCount
in classNativeFunction
-
getParamAndVarCount
protected int getParamAndVarCount()Description copied from class:NativeFunction
Get number of declared parameters and variables defined through var statements.- Specified by:
getParamAndVarCount
in classNativeFunction
-
getParamOrVarName
Description copied from class:NativeFunction
Get parameter or variable name. Ifindex <
, then return the name of the corresponding parameter. Otherwise return the name of variable.NativeFunction.getParamCount()
- Specified by:
getParamOrVarName
in classNativeFunction
-
getParamOrVarConst
protected boolean getParamOrVarConst(int index) Description copied from class:NativeFunction
Get parameter or variable const-ness. Ifindex <
, then return the const-ness of the corresponding parameter. Otherwise return whether the variable is const.NativeFunction.getParamCount()
- Overrides:
getParamOrVarConst
in classNativeFunction
-
toString
Provides the decompiled source of the function what is helpful while debugging. -
setArguments
-
get
Description copied from class:ScriptableObject
Returns the value of the named property or NOT_FOUND.If the property was created using defineProperty, the appropriate getter method is called.
- Specified by:
get
in interfaceScriptable
- Overrides:
get
in classIdScriptableObject
- Parameters:
name
- the name of the propertystart
- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
-
hasFunctionNamed
-