public final class JsFunction extends JsLiteral implements HasName
Modifier and Type | Field and Description |
---|---|
protected JsBlock |
body |
protected List<JsParameter> |
params |
protected JsScope |
scope |
Constructor and Description |
---|
JsFunction(SourceInfo sourceInfo,
JsScope parent)
Creates an anonymous function.
|
JsFunction(SourceInfo sourceInfo,
JsScope parent,
JsName name)
Creates a function that is not derived from Java source.
|
JsFunction(SourceInfo sourceInfo,
JsScope parent,
JsName name,
boolean fromJava)
Creates a named function, possibly derived from Java source.
|
Modifier and Type | Method and Description |
---|---|
static JsFunction |
createSentinel()
Creates a dummy JsFunction object to be used as a sentinel.
|
JsBlock |
getBody() |
boolean |
getExecuteOnce()
If true, this indicates that only the first invocation of the function will have any effects.
|
JsFunction |
getImpliedExecute() |
NodeKind |
getKind() |
JsName |
getName() |
List<JsParameter> |
getParameters() |
JsScope |
getScope() |
boolean |
hasSideEffects()
Determines whether the expression can cause side effects.
|
boolean |
isArtificiallyRescued() |
boolean |
isBooleanFalse() |
boolean |
isBooleanTrue() |
boolean |
isDefinitelyNotNull()
True if the target expression is definitely not null.
|
boolean |
isDefinitelyNull()
True if the target expression is definitely null.
|
boolean |
isFromJava() |
void |
setArtificiallyRescued(boolean rescued) |
void |
setBody(JsBlock body) |
void |
setExecuteOnce(boolean executeOnce) |
void |
setFromJava(boolean fromJava) |
void |
setImpliedExecute(JsFunction impliedExecute) |
void |
setName(JsName name) |
void |
setTrace() |
void |
traverse(JsVisitor v,
JsContext ctx)
Causes this object to have the visitor visit itself and its children.
|
isLeaf, makeStmt
getSourceInfo, setSourceInfo, toSource, toSource, toString
protected JsBlock body
protected final List<JsParameter> params
protected final JsScope scope
public JsFunction(SourceInfo sourceInfo, JsScope parent)
public JsFunction(SourceInfo sourceInfo, JsScope parent, JsName name)
public JsFunction(SourceInfo sourceInfo, JsScope parent, JsName name, boolean fromJava)
public static JsFunction createSentinel()
public JsBlock getBody()
public boolean getExecuteOnce()
public JsFunction getImpliedExecute()
public List<JsParameter> getParameters()
public JsScope getScope()
public boolean hasSideEffects()
JsExpression
hasSideEffects
in class JsExpression
public boolean isArtificiallyRescued()
public boolean isBooleanFalse()
isBooleanFalse
in interface CanBooleanEval
public boolean isBooleanTrue()
isBooleanTrue
in interface CanBooleanEval
public boolean isDefinitelyNotNull()
JsExpression
isDefinitelyNotNull
in class JsExpression
public boolean isDefinitelyNull()
JsExpression
isDefinitelyNull
in class JsExpression
public boolean isFromJava()
public void setArtificiallyRescued(boolean rescued)
public void setBody(JsBlock body)
public void setExecuteOnce(boolean executeOnce)
public void setFromJava(boolean fromJava)
public void setImpliedExecute(JsFunction impliedExecute)
public void setName(JsName name)
public void setTrace()
public void traverse(JsVisitor v, JsContext ctx)
JsVisitable
traverse
in interface JsVisitable
v
- the visitor that should traverse this nodectx
- the context of an existing traversalCopyright © 2018. All rights reserved.