org.mozilla.javascript

Class ScriptOrFnNode

Known Direct Subclasses:
FunctionNode

public class ScriptOrFnNode
extends Node

Nested Class Summary

Nested classes/interfaces inherited from class org.mozilla.javascript.Node

Node.Jump

Field Summary

static int
DUPLICATE_CONST
static int
DUPLICATE_PARAMETER
static int
DUPLICATE_VAR
static int
NO_DUPLICATE

Fields inherited from class org.mozilla.javascript.Node

ATTRIBUTE_FLAG, BOTH, CASEARRAY_PROP, CATCH_SCOPE_PROP, CONTROL_BLOCK_PROP, DECR_FLAG, DESCENDANTS_FLAG, DIRECTCALL_PROP, FUNCTION_PROP, INCRDECR_PROP, ISNUMBER_PROP, LABEL_ID_PROP, LAST_PROP, LEFT, LOCAL_BLOCK_PROP, LOCAL_PROP, MEMBER_TYPE_PROP, NAME_PROP, NON_SPECIALCALL, OBJECT_IDS_PROP, PARENTHESIZED_PROP, POST_FLAG, PROPERTY_FLAG, REGEXP_PROP, RIGHT, SKIP_INDEXES_PROP, SPECIALCALL_EVAL, SPECIALCALL_PROP, SPECIALCALL_WITH, TARGETBLOCK_PROP, VARIABLE_PROP

Constructor Summary

ScriptOrFnNode(int nodeType)

Method Summary

boolean
addConst(String name)
int
addFunction(FunctionNode fnNode)
void
addParam(String name)
int
addRegexp(String string, String flags)
int
addVar(String name)
This function adds a variable to the set of var declarations for a function (or script).
int
getBaseLineno()
Object
getCompilerData()
int
getEncodedSourceEnd()
int
getEncodedSourceStart()
int
getEndLineno()
int
getFunctionCount()
FunctionNode
getFunctionNode(int i)
boolean[]
getParamAndVarConst()
int
getParamAndVarCount()
String[]
getParamAndVarNames()
int
getParamCount()
int
getParamOrVarIndex(String name)
String
getParamOrVarName(int index)
int
getRegexpCount()
String
getRegexpFlags(int index)
String
getRegexpString(int index)
String
getSourceName()
boolean
hasParamOrVar(String name)
void
removeParamOrVar(String name)
void
setBaseLineno(int lineno)
void
setCompilerData(Object data)
void
setEncodedSourceBounds(int start, int end)
void
setEndLineno(int lineno)
void
setSourceName(String sourceName)

Methods inherited from class org.mozilla.javascript.Node

addChildAfter, addChildBefore, addChildToBack, addChildToFront, addChildrenToBack, addChildrenToFront, getChildBefore, getDouble, getExistingIntProp, getFirstChild, getIntProp, getLastChild, getLastSibling, getLineno, getNext, getProp, getString, getType, hasChildren, hasConsistentReturnUsage, hasSideEffects, labelId, labelId, newNumber, newString, newString, newTarget, putIntProp, putProp, removeChild, removeProp, replaceChild, replaceChildAfter, setDouble, setString, setType, toString, toStringTree

Field Details

DUPLICATE_CONST

public static final int DUPLICATE_CONST
Field Value:
-2

DUPLICATE_PARAMETER

public static final int DUPLICATE_PARAMETER
Field Value:
-1

DUPLICATE_VAR

public static final int DUPLICATE_VAR
Field Value:
0

NO_DUPLICATE

public static final int NO_DUPLICATE
Field Value:
1

Constructor Details

ScriptOrFnNode

public ScriptOrFnNode(int nodeType)

Method Details

addConst

public final boolean addConst(String name)

addFunction

public final int addFunction(FunctionNode fnNode)

addParam

public final void addParam(String name)

addRegexp

public final int addRegexp(String string,
                           String flags)

addVar

public final int addVar(String name)
This function adds a variable to the set of var declarations for a function (or script). This returns an indicator of a duplicate that overrides a formal parameter (false if this dups a parameter).
Parameters:
name - variable name
Returns:
1 if the name is not any form of duplicate, 0 if it duplicates a non-parameter, -1 if it duplicates a parameter and -2 if it duplicates a const.

getBaseLineno

public final int getBaseLineno()

getCompilerData

public final Object getCompilerData()

getEncodedSourceEnd

public final int getEncodedSourceEnd()

getEncodedSourceStart

public final int getEncodedSourceStart()

getEndLineno

public final int getEndLineno()

getFunctionCount

public final int getFunctionCount()

getFunctionNode

public final FunctionNode getFunctionNode(int i)

getParamAndVarConst

public final boolean[] getParamAndVarConst()

getParamAndVarCount

public final int getParamAndVarCount()

getParamAndVarNames

public final String[] getParamAndVarNames()

getParamCount

public final int getParamCount()

getParamOrVarIndex

public final int getParamOrVarIndex(String name)

getParamOrVarName

public final String getParamOrVarName(int index)

getRegexpCount

public final int getRegexpCount()

getRegexpFlags

public final String getRegexpFlags(int index)

getRegexpString

public final String getRegexpString(int index)

getSourceName

public final String getSourceName()

hasParamOrVar

public final boolean hasParamOrVar(String name)

removeParamOrVar

public final void removeParamOrVar(String name)

setBaseLineno

public final void setBaseLineno(int lineno)

setCompilerData

public final void setCompilerData(Object data)

setEncodedSourceBounds

public final void setEncodedSourceBounds(int start,
                                         int end)

setEndLineno

public final void setEndLineno(int lineno)

setSourceName

public final void setSourceName(String sourceName)