org.mozilla.javascript
Class NativeFunction
java.lang.Object
|
+--org.mozilla.javascript.ScriptableObject
|
+--org.mozilla.javascript.IdScriptable
|
+--org.mozilla.javascript.BaseFunction
|
+--org.mozilla.javascript.NativeFunction
- All Implemented Interfaces:
- Function, IdFunctionMaster, Scriptable, java.io.Serializable
- Direct Known Subclasses:
- FunctionObject, NativeJavaConstructor, NativeJavaMethod, NativeRegExpCtor, NativeScript
- public class NativeFunction
- extends BaseFunction
This class implements the Function native object.
See ECMA 15.3.
- Author:
- Norris Boyd
- See Also:
- Serialized Form
Method Summary |
java.lang.String |
decompile(Context cx,
int indent,
boolean justbody)
Decompile the source information associated with this js
function/script back into a string. |
int |
getArity()
|
int |
getLength()
|
java.lang.String |
jsGet_name()
For backwards compatibility keep an old method name used by
Batik and possibly others. |
Methods inherited from class org.mozilla.javascript.ScriptableObject |
callMethod, defineClass, defineClass, defineFunctionProperties, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, get, getAllIds, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, has, hasProperty, hasProperty, isSealed, put, putProperty, putProperty, sealObject, setAttributes, setParentScope, setPrototype |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mozilla.javascript.Scriptable |
delete, delete, get, get, getDefaultValue, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype |
nestedFunctions
public NativeFunction[] nestedFunctions
- An array of NativeFunction values for each nested function.
Used internally, and also for decompiling nested functions.
debug_level
public int debug_level
debug_srcName
public java.lang.String debug_srcName
NativeFunction
public NativeFunction()
decompile
public java.lang.String decompile(Context cx,
int indent,
boolean justbody)
- Decompile the source information associated with this js
function/script back into a string. For the most part, this
just means translating tokens back to their string
representations; there's a little bit of lookahead logic to
decide the proper spacing/indentation. Most of the work in
mapping the original source to the prettyprinted decompiled
version is done by the parser.
Note that support for Context.decompileFunctionBody is hacked
on through special cases; I suspect that js makes a distinction
between function header and function body that rhino
decompilation does not.
- Overrides:
decompile
in class BaseFunction
- Parameters:
cx
- Current contextindent
- How much to indent the decompiled resultjustbody
- Whether the decompilation should omit the
function header and trailing brace.
getLength
public int getLength()
- Overrides:
getLength
in class BaseFunction
getArity
public int getArity()
- Overrides:
getArity
in class BaseFunction
jsGet_name
public java.lang.String jsGet_name()
- For backwards compatibility keep an old method name used by
Batik and possibly others.