public class JSFunction extends BaseFunction implements ScriptOrFn<JSFunction>
JSDescriptor. All the immutable metadata
associated with the function is stored on the descriptor, with only the lexically bound this, the
home object required for super calls, and mutable properties held on the function object itself.ScriptableObject.DescriptorInfo, ScriptableObject.KeyComparator, ScriptableObject.LambdaGetterFunction, ScriptableObject.LambdaSetterFunctionId_arguments, Id_arity, Id_length, Id_name, Id_prototype, MAX_INSTANCE_IDCONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTNOT_FOUND| Constructor and Description |
|---|
JSFunction(Context cx,
Scriptable scope,
JSDescriptor<JSFunction> descriptor,
Scriptable lexicalThis,
Scriptable homeObject) |
| Modifier and Type | Method and Description |
|---|---|
Object |
call(Context cx,
Scriptable scope,
Scriptable thisObj,
Object[] args)
Should be overridden.
|
Scriptable |
construct(Context cx,
Scriptable scope,
Object[] args)
Call the function as a constructor.
|
static JSFunction |
createFunction(Context cx,
Scriptable scope,
JSDescriptor<JSFunction> desc,
Scriptable homeObject,
Object staticSecurityDomain)
Create function compiled from Function(...) constructor.
|
protected void |
createPrototypeProperty() |
static JSScript |
createScript(JSDescriptor<JSScript> desc,
Scriptable homeObject,
Object staticSecurityDomain)
Create script from compiled bytecode.
|
Object |
get(String name,
Scriptable start)
Returns the value of the named property or NOT_FOUND.
|
int |
getArity() |
DebuggableScript |
getDebuggableView() |
Scriptable |
getDeclarationScope()
Return the scope in which this function was declared or closed over.
|
JSDescriptor<JSFunction> |
getDescriptor() |
String |
getFunctionName() |
Scriptable |
getFunctionThis(Scriptable functionThis) |
Scriptable |
getHomeObject() |
protected int |
getLanguageVersion() |
int |
getLength() |
protected int |
getParamAndVarCount() |
protected int |
getParamCount() |
protected boolean |
getParamOrVarConst(int index) |
protected String |
getParamOrVarName(int index) |
String |
getRawSource() |
protected boolean |
hasDefaultParameters() |
boolean |
hasFunctionNamed(String name) |
protected boolean |
hasPrototypeProperty() |
protected boolean |
isGeneratorFunction() |
boolean |
isScript() |
boolean |
isShorthand() |
boolean |
isStrict() |
Object |
resumeGenerator(Context cx,
Scriptable scope,
int operation,
Object state,
Object value) |
void |
setHomeObject(Scriptable homeObject) |
createObject, createProperties, createPrototypeProperty, defaultGet, defaultHas, defaultPut, getClassName, getClassPrototype, getPrototypeProperty, getTypeOf, hasInstance, includeNonStandardProps, prototypeDescSetter, setImmunePrototypeProperty, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototypeapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, equivalentValues, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, sizecreateSlotMapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdelete, delete, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototypepublic JSFunction(Context cx, Scriptable scope, JSDescriptor<JSFunction> descriptor, Scriptable lexicalThis, Scriptable homeObject)
public Scriptable getDeclarationScope()
FunctiongetDeclarationScope in interface FunctiongetDeclarationScope in interface ScriptOrFn<JSFunction>public JSDescriptor<JSFunction> getDescriptor()
getDescriptor in interface ScriptOrFn<JSFunction>public boolean isShorthand()
public boolean isStrict()
public int getArity()
getArity in class BaseFunctionpublic DebuggableScript getDebuggableView()
protected int getLanguageVersion()
protected boolean hasPrototypeProperty()
hasPrototypeProperty in class BaseFunctionprotected boolean isGeneratorFunction()
isGeneratorFunction in class BaseFunctionpublic int getLength()
getLength in class BaseFunctionprotected int getParamAndVarCount()
protected int getParamCount()
protected boolean getParamOrVarConst(int index)
protected String getParamOrVarName(int index)
public String getRawSource()
protected void createPrototypeProperty()
createPrototypeProperty in class BaseFunctionpublic Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
BaseFunctioncall in interface Callablecall in interface Functioncall in class BaseFunctioncx - the current Context for this threadscope - the scope to execute the function relative to. This is set to the value returned
by getParentScope() except when the function is called from a closure.thisObj - the JavaScript this objectargs - the array of argumentspublic Scriptable construct(Context cx, Scriptable scope, Object[] args)
FunctionThis method is invoked by the runtime in order to satisfy a use of the JavaScript new operator. This method is expected to create a new object and return it.
construct in interface Constructableconstruct in interface Functionconstruct in class BaseFunctioncx - the current Context for this threadscope - an enclosing scope of the caller except when the function is called from a
closure.args - the array of argumentspublic boolean isScript()
protected boolean hasDefaultParameters()
hasDefaultParameters in class BaseFunctionpublic boolean hasFunctionNamed(String name)
public String getFunctionName()
getFunctionName in class BaseFunctionpublic Object resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value)
public Scriptable getHomeObject()
getHomeObject in interface ScriptOrFn<JSFunction>getHomeObject in class BaseFunctionpublic void setHomeObject(Scriptable homeObject)
setHomeObject in class BaseFunctionpublic Scriptable getFunctionThis(Scriptable functionThis)
public static JSScript createScript(JSDescriptor<JSScript> desc, Scriptable homeObject, Object staticSecurityDomain)
public static JSFunction createFunction(Context cx, Scriptable scope, JSDescriptor<JSFunction> desc, Scriptable homeObject, Object staticSecurityDomain)
public Object get(String name, Scriptable start)
ScriptableObjectIf the property was created using defineProperty, the appropriate getter method is called.
get in interface Scriptableget in class ScriptableObjectname - the name of the propertystart - the object in which the lookup beganContext.getUndefinedValue()Copyright © 2025 HtmlUnit. All rights reserved.