public final class JSDescriptor<T extends ScriptOrFn<T>> extends Object implements Serializable, DebuggableScript
JSFunctions become more lightweight in their creation.| Modifier and Type | Class and Description |
|---|---|
static class |
JSDescriptor.Builder<T extends ScriptOrFn<T>>
A mutable object for creating the final immutable
JSDescriptor. |
| Modifier and Type | Field and Description |
|---|---|
List<JSDescriptor<JSFunction>> |
nestedFunctions |
| Constructor and Description |
|---|
JSDescriptor(JSCode<T> code,
JSCode<T> constructor,
JSDescriptor<?> parent,
String[] paramAndVarNames,
boolean[] paramIsConst,
boolean isStrict,
boolean isScript,
boolean isTopLevel,
boolean isES6Generator,
boolean isShorthand,
boolean hasPrototype,
boolean hasLexicalThis,
boolean isEvalFunction,
boolean hasRestArg,
String sourceFile,
String rawSource,
int rawSourceStart,
int rawSourceEnd,
String name,
int languageVersion,
int paramAndVarCount,
int paramCount,
int arity,
boolean hasDefaultParameters,
boolean requiresActivationFrame,
boolean requiresArgumentObject,
boolean declaredAsFunctionExpression,
SecurityController securityController,
Object securityDomain,
int functionType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
declaredAsFunctionExpression() |
int |
getArity() |
JSCode<T> |
getCode() |
JSCode<T> |
getConstructor() |
JSDescriptor<JSFunction> |
getFunction(int index) |
int |
getFunctionCount() |
String |
getFunctionName()
Get name of the function described by this script.
|
int |
getFunctionType() |
int |
getLanguageVersion() |
int[] |
getLineNumbers()
Get array containing the line numbers that that can be passed to
DebugFrame.onLineChange(). |
String |
getName() |
List<JSDescriptor<JSFunction>> |
getNestedFunctions() |
int |
getParamAndVarCount()
Get number of declared parameters and local variables.
|
int |
getParamCount()
Get number of declared parameters in the function.
|
boolean |
getParamOrVarConst(int index) |
String |
getParamOrVarName(int index)
Get name of a declared parameter or local variable.
|
DebuggableScript |
getParent() |
String |
getRawSource() |
SecurityController |
getSecurityController() |
Object |
getSecurityDomain() |
String |
getSourceName()
Get the name of the source (usually filename or URL) of the script.
|
boolean |
hasDefaultParameters() |
boolean |
hasFunctionNamed(String name) |
boolean |
hasLexicalThis() |
boolean |
hasPrototype() |
boolean |
hasRestArg() |
boolean |
isES6Generator() |
boolean |
isEvalFunction() |
boolean |
isFunction()
Returns true if this is a function, false if it is a script.
|
boolean |
isGeneratedScript()
Returns true if this script or function were runtime-generated from JavaScript using
eval function or Function or Script constructors. |
boolean |
isScript() |
boolean |
isShorthand() |
boolean |
isStrict() |
boolean |
isTopLevel() |
boolean |
requiresActivationFrame() |
boolean |
requiresArgumentObject() |
public List<JSDescriptor<JSFunction>> nestedFunctions
public JSDescriptor(JSCode<T> code, JSCode<T> constructor, JSDescriptor<?> parent, String[] paramAndVarNames, boolean[] paramIsConst, boolean isStrict, boolean isScript, boolean isTopLevel, boolean isES6Generator, boolean isShorthand, boolean hasPrototype, boolean hasLexicalThis, boolean isEvalFunction, boolean hasRestArg, String sourceFile, String rawSource, int rawSourceStart, int rawSourceEnd, String name, int languageVersion, int paramAndVarCount, int paramCount, int arity, boolean hasDefaultParameters, boolean requiresActivationFrame, boolean requiresArgumentObject, boolean declaredAsFunctionExpression, SecurityController securityController, Object securityDomain, int functionType)
public List<JSDescriptor<JSFunction>> getNestedFunctions()
public boolean isStrict()
public boolean isScript()
public boolean isTopLevel()
isTopLevel in interface DebuggableScriptpublic boolean isFunction()
DebuggableScriptisFunction in interface DebuggableScriptpublic boolean isES6Generator()
public boolean isShorthand()
public boolean hasPrototype()
public boolean hasLexicalThis()
public boolean isEvalFunction()
public boolean hasRestArg()
public String getSourceName()
DebuggableScriptgetSourceName in interface DebuggableScriptpublic String getRawSource()
public String getName()
public int getLanguageVersion()
public int getParamAndVarCount()
DebuggableScriptgetParamAndVarCount in interface DebuggableScriptDebuggableScript.getParamCount(),
DebuggableScript.getParamOrVarName(int index)public int getParamCount()
DebuggableScriptgetParamCount in interface DebuggableScriptDebuggableScript.getParamAndVarCount(),
DebuggableScript.getParamOrVarName(int index)public int getArity()
public boolean getParamOrVarConst(int index)
public String getParamOrVarName(int index)
DebuggableScriptindex should be less then DebuggableScript.getParamAndVarCount(). If index < DebuggableScript.getParamCount() ,
return the name of the corresponding parameter, otherwise return the name of variable. If
this script is not function, return the name of the declared global variable.getParamOrVarName in interface DebuggableScriptpublic boolean hasDefaultParameters()
public boolean hasFunctionNamed(String name)
public int getFunctionCount()
getFunctionCount in interface DebuggableScriptpublic JSDescriptor<JSFunction> getFunction(int index)
getFunction in interface DebuggableScriptpublic String getFunctionName()
DebuggableScriptgetFunctionName in interface DebuggableScriptpublic boolean isGeneratedScript()
DebuggableScripteval function or Function or Script constructors.isGeneratedScript in interface DebuggableScriptpublic int[] getLineNumbers()
DebuggableScriptDebugFrame.onLineChange(). Note that line order in the resulting array is arbitrarygetLineNumbers in interface DebuggableScriptpublic boolean requiresActivationFrame()
public boolean requiresArgumentObject()
public boolean declaredAsFunctionExpression()
public SecurityController getSecurityController()
public Object getSecurityDomain()
public int getFunctionType()
public DebuggableScript getParent()
getParent in interface DebuggableScriptCopyright © 2025 HtmlUnit. All rights reserved.