Package org.htmlunit.corejs.javascript
Class NativeFunction
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.IdScriptableObject
-
- org.htmlunit.corejs.javascript.BaseFunction
-
- org.htmlunit.corejs.javascript.NativeFunction
-
- All Implemented Interfaces:
java.io.Serializable
,Callable
,ConstProperties
,Constructable
,DebuggableObject
,Function
,IdFunctionCall
,Scriptable
,SymbolScriptable
- Direct Known Subclasses:
InterpretedFunction
public abstract class NativeFunction extends BaseFunction
This class implements the Function native object. See ECMA 15.3.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
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
Constructors Constructor Description NativeFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) java.lang.String
decompile(int indent, int flags)
Decompile the source information associated with this js function/script back into a string.int
getArity()
DebuggableScript
getDebuggableView()
java.lang.String
getEncodedSource()
Get encoded source string.protected abstract int
getLanguageVersion()
int
getLength()
protected abstract int
getParamAndVarCount()
Get number of declared parameters and variables defined through var statements.protected abstract int
getParamCount()
Get number of declared parameters.protected boolean
getParamOrVarConst(int index)
Get parameter or variable const-ness.protected abstract java.lang.String
getParamOrVarName(int index)
Get parameter or variable name.void
initScriptFunction(Context cx, Scriptable scope)
void
initScriptFunction(Context cx, Scriptable scope, boolean es6GeneratorFunction)
java.lang.String
jsGet_name()
Deprecated.UseBaseFunction.getFunctionName()
instead.java.lang.Object
resumeGenerator(Context cx, Scriptable scope, int operation, java.lang.Object state, java.lang.Object value)
Resume execution of a suspended generator.-
Methods inherited from class org.htmlunit.corejs.javascript.BaseFunction
call, construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getClassName, getClassPrototype, getFunctionName, 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, 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, toString, wait, wait, wait
-
Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
initScriptFunction
public final void initScriptFunction(Context cx, Scriptable scope)
-
initScriptFunction
public final void initScriptFunction(Context cx, Scriptable scope, boolean es6GeneratorFunction)
-
decompile
final java.lang.String decompile(int indent, int flags)
Description copied from class:BaseFunction
Decompile the source information associated with this js function/script back into a string.- Overrides:
decompile
in classBaseFunction
- Parameters:
indent
- How much to indent the decompiled resultflags
- Flags specifying format of decompilation output
-
getLength
public int getLength()
- Overrides:
getLength
in classBaseFunction
-
getArity
public int getArity()
- Overrides:
getArity
in classBaseFunction
-
jsGet_name
@Deprecated public java.lang.String jsGet_name()
Deprecated.UseBaseFunction.getFunctionName()
instead. For backwards compatibility keep an old method name used by Batik and possibly others.
-
getEncodedSource
public java.lang.String getEncodedSource()
Get encoded source string.
-
getDebuggableView
public DebuggableScript getDebuggableView()
-
resumeGenerator
public java.lang.Object resumeGenerator(Context cx, Scriptable scope, int operation, java.lang.Object state, java.lang.Object value)
Resume execution of a suspended generator.- 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 abstract int getLanguageVersion()
-
getParamCount
protected abstract int getParamCount()
Get number of declared parameters. It should be 0 for scripts.
-
getParamAndVarCount
protected abstract int getParamAndVarCount()
Get number of declared parameters and variables defined through var statements.
-
getParamOrVarName
protected abstract java.lang.String getParamOrVarName(int index)
Get parameter or variable name. Ifindex <
, then return the name of the corresponding parameter. Otherwise return the name of variable.getParamCount()
-
getParamOrVarConst
protected boolean getParamOrVarConst(int index)
Get parameter or variable const-ness. Ifindex <
, then return the const-ness of the corresponding parameter. Otherwise return whether the variable is const.getParamCount()
-
-