org.mozilla.javascript

Class NativeFunction

Implemented Interfaces:
Callable, ConstProperties, DebuggableObject, Function, IdFunctionCall, Scriptable, Serializable

public abstract class NativeFunction
extends BaseFunction

This class implements the Function native object. See ECMA 15.3.
Author:
Norris Boyd

Field Summary

Fields inherited from class org.mozilla.javascript.ScriptableObject

CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

Fields inherited from interface org.mozilla.javascript.Scriptable

NOT_FOUND

Method Summary

DebuggableScript
getDebuggableView()
String
getEncodedSource()
Get encoded source string.
protected abstract int
getLanguageVersion()
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 String
getParamOrVarName(int index)
Get parameter or variable name.
void
initScriptFunction(Context cx, Scriptable scope)
@Override
int getArity()
@Override
int getLength()
String
jsGet_name()
Deprecated. Use BaseFunction.getFunctionName() instead.
Object
resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value)
Resume execution of a suspended generator.

Methods inherited from class org.mozilla.javascript.BaseFunction

Object execIdCall, Object getInstanceIdValue, String getClassName, String getInstanceIdName, boolean hasInstance, call, construct, createObject, getArity, getClassPrototype, getFunctionName, getLength, int findInstanceIdInfo, int findPrototypeId, int getMaxInstanceId, setImmunePrototypeProperty, void fillConstructorProperties, void initPrototypeId, void setInstanceIdValue

Methods inherited from class org.mozilla.javascript.IdScriptableObject

Object get, activatePrototypeMap, addIdFunctionProperty, boolean has, defaultGet, defaultPut, execIdCall, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeId, initPrototypeMethod, initPrototypeValue, instanceIdInfo, int getAttributes, setInstanceIdValue, void delete, void put, void setAttributes

Methods inherited from class org.mozilla.javascript.ScriptableObject

associateValue, avoidObjectDetection, callMethod, callMethod, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, extends Scriptable> String defineClass, extends Scriptable> void defineClass, extends Scriptable> void defineClass, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype

Method Details

getDebuggableView

public DebuggableScript getDebuggableView()

getEncodedSource

public String getEncodedSource()
Get encoded source string.

getLanguageVersion

protected abstract int getLanguageVersion()

getParamAndVarCount

protected abstract int getParamAndVarCount()
Get number of declared parameters and variables defined through var statements.

getParamCount

protected abstract int getParamCount()
Get number of declared parameters. It should be 0 for scripts.

getParamOrVarConst

protected boolean getParamOrVarConst(int index)
Get parameter or variable const-ness. If index <32getParamCount(), then return the const-ness of the corresponding parameter. Otherwise return whether the variable is const.

getParamOrVarName

protected abstract String getParamOrVarName(int index)
Get parameter or variable name. If index <32getParamCount(), then return the name of the corresponding parameter. Otherwise return the name of variable.

initScriptFunction

public final void initScriptFunction(Context cx,
                                     Scriptable scope)

int getArity

public @Override int getArity()

int getLength

public @Override int getLength()

jsGet_name

public String jsGet_name()

Deprecated. Use BaseFunction.getFunctionName() instead. For backwards compatibility keep an old method name used by Batik and possibly others.


resumeGenerator

public Object resumeGenerator(Context cx,
                              Scriptable scope,
                              int operation,
                              Object state,
                              Object value)
Resume execution of a suspended generator.
Parameters:
cx - The current context
scope - Scope for the parent generator function
operation - 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)