org.mozilla.javascript

Class BaseFunction

public class BaseFunction extends IdScriptableObject implements Function

The base class for Function objects See ECMA 15.3.

Author: Norris Boyd

Constructor Summary
BaseFunction()
BaseFunction(Scriptable scope, Scriptable prototype)
Method Summary
Objectcall(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Should be overridden.
Scriptableconstruct(Context cx, Scriptable scope, Object[] args)
ScriptablecreateObject(Context cx, Scriptable scope)
Creates new script object.
ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
protected voidfillConstructorProperties(IdFunctionObject ctor)
protected intfindInstanceIdInfo(String s)
protected intfindPrototypeId(String s)
intgetArity()
StringgetClassName()
protected ScriptablegetClassPrototype()
StringgetFunctionName()
protected StringgetInstanceIdName(int id)
protected ObjectgetInstanceIdValue(int id)
intgetLength()
protected intgetMaxInstanceId()
booleanhasInstance(Scriptable instance)
Implements the instanceof operator for JavaScript Function objects.
protected voidinitPrototypeId(int id)
voidsetImmunePrototypeProperty(Object value)
Make value as DontEnum, DontDelete, ReadOnly prototype property of this Function object
protected voidsetInstanceIdValue(int id, Object value)

Constructor Detail

BaseFunction

public BaseFunction()

BaseFunction

public BaseFunction(Scriptable scope, Scriptable prototype)

Method Detail

call

public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
Should be overridden.

construct

public Scriptable construct(Context cx, Scriptable scope, Object[] args)

createObject

public Scriptable createObject(Context cx, Scriptable scope)
Creates new script object. The default implementation of {@link #construct} uses the method to to get the value for thisObj argument when invoking {@link #call}. The methos is allowed to return null to indicate that {@link #call} will create a new object itself. In this case {@link #construct} will set scope and prototype on the result {@link #call} unless they are already set.

execIdCall

public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)

fillConstructorProperties

protected void fillConstructorProperties(IdFunctionObject ctor)

findInstanceIdInfo

protected int findInstanceIdInfo(String s)

findPrototypeId

protected int findPrototypeId(String s)

getArity

public int getArity()

getClassName

public String getClassName()

getClassPrototype

protected Scriptable getClassPrototype()

getFunctionName

public String getFunctionName()

getInstanceIdName

protected String getInstanceIdName(int id)

getInstanceIdValue

protected Object getInstanceIdValue(int id)

getLength

public int getLength()

getMaxInstanceId

protected int getMaxInstanceId()

hasInstance

public boolean hasInstance(Scriptable instance)
Implements the instanceof operator for JavaScript Function objects.

foo = new Foo();
foo instanceof Foo; // true

Parameters: instance The value that appeared on the LHS of the instanceof operator

Returns: true if the "prototype" property of "this" appears in value's prototype chain

initPrototypeId

protected void initPrototypeId(int id)

setImmunePrototypeProperty

public void setImmunePrototypeProperty(Object value)
Make value as DontEnum, DontDelete, ReadOnly prototype property of this Function object

setInstanceIdValue

protected void setInstanceIdValue(int id, Object value)