The base class for Function objects
See ECMA 15.3.
Object getInstanceIdValue
protected @Override Object getInstanceIdValue(int id)
String getClassName
public @Override String getClassName()
String getInstanceIdName
protected @Override String getInstanceIdName(int id)
boolean hasInstance
public @Override boolean hasInstance(Scriptable instance)
Implements the instanceof operator for JavaScript Function objects.
foo = new Foo();
foo instanceof Foo; // true
instance
- The value that appeared on the LHS of the instanceof
operator
- true if the "prototype" property of "this" appears in
value's prototype chain
construct
public Scriptable construct(Context cx,
Scriptable scope,
Object[] args)
Call the function as a constructor.
This 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 Function
cx
- 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 arguments
createObject
public Scriptable createObject(Context cx,
Scriptable scope)
Creates new script object.
The default implementation of
construct(Context,Scriptable,Object[])
uses the method to
to get the value for
thisObj argument when invoking
call(Context,Scriptable,Scriptable,Object[])
.
The methos is allowed to return
null to indicate that
call(Context,Scriptable,Scriptable,Object[])
will create a new object itself. In this case
construct(Context,Scriptable,Object[])
will set scope and prototype on the result
call(Context,Scriptable,Scriptable,Object[])
unless they are already set.
getArity
public int getArity()
getClassPrototype
protected Scriptable getClassPrototype()
getFunctionName
public String getFunctionName()
getLength
public int getLength()
int findInstanceIdInfo
protected @Override int findInstanceIdInfo(String s)
int findPrototypeId
protected @Override int findPrototypeId(String s)
int getMaxInstanceId
protected @Override int getMaxInstanceId()
setImmunePrototypeProperty
public void setImmunePrototypeProperty(Object value)
Make value as DontEnum, DontDelete, ReadOnly
prototype property of this Function object
void fillConstructorProperties
protected @Override void fillConstructorProperties(IdFunctionObject ctor)
void initPrototypeId
protected @Override void initPrototypeId(int id)
void setInstanceIdValue
protected @Override void setInstanceIdValue(int id,
Object value)