public class Var extends java.lang.Object implements StaticSlot, StaticRef
Scope to store information about variables.| Modifier and Type | Class and Description |
|---|---|
private static class |
Var.Arguments
A special subclass of Var used to distinguish "arguments" in the current
scope.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) int |
index
The index at which the var is declared.
|
(package private) CompilerInput |
input
Input source
|
(package private) java.lang.String |
name |
(package private) Node |
nameNode
Var node
|
(package private) Scope |
scope
The enclosing scope
|
| Constructor and Description |
|---|
Var(java.lang.String name,
Node nameNode,
Scope scope,
int index,
CompilerInput input) |
| Modifier and Type | Method and Description |
|---|---|
protected int |
declarationType() |
boolean |
equals(java.lang.Object other) |
Var |
getDeclaration()
Gets the declaration of this symbol.
|
Node |
getInitialValue() |
(package private) CompilerInput |
getInput() |
JSDocInfo |
getJSDocInfo()
Gets the JSDoc for this slot.
|
java.lang.String |
getName()
Gets the name of the slot.
|
Node |
getNameNode() |
Node |
getNode()
The node where the reference lives.
|
Node |
getParentNode() |
Scope |
getScope() |
StaticSourceFile |
getSourceFile()
The source file where the reference lives.
|
Var |
getSymbol()
The variable that this reference points to.
|
int |
hashCode() |
boolean |
isArguments() |
boolean |
isBleedingFunction()
Whether this is a bleeding function (an anonymous named function
that bleeds into the inner scope).
|
(package private) boolean |
isCatch() |
(package private) boolean |
isClass() |
(package private) boolean |
isConst() |
(package private) boolean |
isDefaultParam() |
boolean |
isDefine()
Returns
true if the variable is declared as a define. |
(package private) boolean |
isExtern() |
boolean |
isGlobal() |
boolean |
isInferredConst()
Returns
true if the variable is declared as a constant,
based on the value reported by NodeUtil. |
(package private) boolean |
isLet() |
boolean |
isLocal() |
(package private) boolean |
isParam() |
(package private) boolean |
isVar() |
(package private) static Var |
makeArgumentsVar(Scope scope) |
java.lang.String |
toString() |
final java.lang.String name
final Node nameNode
final CompilerInput input
final int index
final Scope scope
Var(java.lang.String name,
Node nameNode,
Scope scope,
int index,
CompilerInput input)
public java.lang.String getName()
StaticSlotgetName in interface StaticSlotpublic Node getNode()
StaticRefCompilerInput getInput()
public StaticSourceFile getSourceFile()
StaticRefgetSourceFile in interface StaticRefpublic Var getSymbol()
StaticRefpublic Var getDeclaration()
StaticSlotgetDeclaration in interface StaticSlotpublic Node getParentNode()
public boolean isBleedingFunction()
public Scope getScope()
public boolean isGlobal()
public boolean isLocal()
boolean isExtern()
public boolean isInferredConst()
true if the variable is declared as a constant,
based on the value reported by NodeUtil.public boolean isDefine()
true if the variable is declared as a define.
A variable is a define if it is annotated by @define.public Node getInitialValue()
public Node getNameNode()
public JSDocInfo getJSDocInfo()
StaticSlotgetJSDocInfo in interface StaticSlotpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectboolean isVar()
boolean isCatch()
boolean isLet()
boolean isConst()
boolean isClass()
boolean isParam()
boolean isDefaultParam()
public boolean isArguments()
protected int declarationType()