public final class Scope extends Object
| Modifier and Type | Field and Description |
|---|---|
protected List<Map.Entry<VarNode,Scope>> |
hoistableBlockFunctionDeclarations |
protected List<Map.Entry<VarNode,Scope>> |
hoistedVarDeclarations |
protected org.graalvm.collections.EconomicMap<String,Symbol> |
symbols
Symbol table - keys must be returned in the order they were put in.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addPrivateName(String name,
int symbolFlags)
Add a private bound identifier.
|
void |
close()
Closes the scope for symbol registration.
|
static Scope |
createBlock(Scope parent) |
static Scope |
createCatch(Scope parent) |
static Scope |
createClass(Scope parent) |
static Scope |
createEval(Scope parent,
boolean strict) |
static Scope |
createFunctionBody(Scope parent,
int functionFlags) |
static Scope |
createGlobal() |
static Scope |
createModule() |
static Scope |
createParameter(Scope parent,
int functionFlags) |
static Scope |
createSwitchBlock(Scope parent) |
void |
declareHoistedBlockFunctionDeclarations() |
Symbol |
findBlockScopedSymbolInFunction(String varName)
Returns a block scoped symbol in this scope or any of its enclosing scopes within this
function.
|
boolean |
findPrivateName(String name) |
Symbol |
getExistingSymbol(String name)
Retrieves an existing symbol defined in the current block.
|
Scope |
getParent() |
int |
getSymbolCount()
Get the number of symbols defined in this block.
|
Iterable<Symbol> |
getSymbols()
Get all the symbols defined in this block, in definition order.
|
boolean |
hasBlockScopedOrRedeclaredSymbols() |
boolean |
hasDeclarations() |
boolean |
hasHoistedVarDeclarations() |
boolean |
hasSymbol(String name)
Test if a symbol with this name is defined in the current block.
|
boolean |
inClassFieldInitializer() |
boolean |
inDerivedConstructor() |
boolean |
inFunction() |
boolean |
inMethod() |
boolean |
isBlockScope() |
boolean |
isCatchParameterScope() |
boolean |
isClassScope() |
boolean |
isEvalScope() |
boolean |
isFunctionBodyScope() |
boolean |
isFunctionParameterScope() |
boolean |
isFunctionTopScope() |
boolean |
isGlobalScope() |
boolean |
isLexicallyDeclaredName(String varName,
boolean annexB,
boolean includeParameters)
Returns true if the name is lexically declared in this scope or any of its enclosing scopes
within this function.
|
boolean |
isModuleScope() |
boolean |
isSwitchBlockScope() |
Symbol |
putSymbol(Symbol symbol)
Add or overwrite an existing symbol in the block
|
void |
recordHoistableBlockFunctionDeclaration(VarNode functionDeclaration,
Scope scope) |
void |
recordHoistedVarDeclaration(VarNode varDecl,
Scope scope) |
String |
toString() |
VarNode |
verifyHoistedVarDeclarations() |
protected final org.graalvm.collections.EconomicMap<String,Symbol> symbols
public static Scope createGlobal()
public static Scope createModule()
public Scope getParent()
public Iterable<Symbol> getSymbols()
public Symbol getExistingSymbol(String name)
name - the name of the symbolpublic boolean hasSymbol(String name)
name - the name of the symbolpublic int getSymbolCount()
public boolean hasBlockScopedOrRedeclaredSymbols()
public boolean hasDeclarations()
public boolean isLexicallyDeclaredName(String varName, boolean annexB, boolean includeParameters)
varName - the declared nameannexB - if true, ignore catch parametersincludeParameters - include parameter scope?public Symbol findBlockScopedSymbolInFunction(String varName)
varName - the symbol namepublic VarNode verifyHoistedVarDeclarations()
public boolean hasHoistedVarDeclarations()
public void recordHoistableBlockFunctionDeclaration(VarNode functionDeclaration, Scope scope)
public void declareHoistedBlockFunctionDeclarations()
public boolean addPrivateName(String name, int symbolFlags)
public boolean findPrivateName(String name)
public boolean isBlockScope()
public boolean isFunctionBodyScope()
public boolean isFunctionParameterScope()
public boolean isCatchParameterScope()
public boolean isGlobalScope()
public boolean isModuleScope()
public boolean isFunctionTopScope()
public boolean isSwitchBlockScope()
public boolean isClassScope()
public boolean isEvalScope()
public boolean inFunction()
public boolean inMethod()
public boolean inDerivedConstructor()
public boolean inClassFieldInitializer()
public void close()