Scopes
Scopes models the nested declaration stack used by the checker.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Scopes(
parent?,scopes?):Scopes
Parameters
Section titled “Parameters”parent?
Section titled “parent?”Scopes
scopes?
Section titled “scopes?”Group = ...
Returns
Section titled “Returns”Scopes
Properties
Section titled “Properties”parent?
Section titled “parent?”
readonlyoptionalparent?:Scopes
scopes
Section titled “scopes”
readonlyscopes:Group
Methods
Section titled “Methods”addIdent()
Section titled “addIdent()”addIdent(
decl):void
addIdent stores an identifier in the current frame.
Parameters
Section titled “Parameters”VariableDecl
Returns
Section titled “Returns”void
copy()
Section titled “copy()”copy():
Scopes
copy clones the full scope chain.
Returns
Section titled “Returns”Scopes
findFunction()
Section titled “findFunction()”findFunction(
name):FunctionDecl|undefined
findFunction resolves a function from inner to outer scope.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”FunctionDecl | undefined
findGlobalIdent()
Section titled “findGlobalIdent()”findGlobalIdent(
name):VariableDecl|undefined
findGlobalIdent resolves an identifier from the root frame only.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”VariableDecl | undefined
findIdent()
Section titled “findIdent()”findIdent(
name):VariableDecl|undefined
findIdent resolves an identifier from inner to outer scope.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”VariableDecl | undefined
findIdentInScope()
Section titled “findIdentInScope()”findIdentInScope(
name):VariableDecl|undefined
findIdentInScope resolves an identifier only in the current frame.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”VariableDecl | undefined
findLocalIdent()
Section titled “findLocalIdent()”findLocalIdent(
name):VariableDecl|undefined
findLocalIdent resolves an identifier while ignoring the root frame.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”VariableDecl | undefined
pop():
Scopes
pop returns the parent scope when present.
Returns
Section titled “Returns”Scopes
push()
Section titled “push()”push():
Scopes
push creates a new innermost scope frame.
Returns
Section titled “Returns”Scopes
setFunction()
Section titled “setFunction()”setFunction(
fn):void
setFunction stores a function in the current frame.
Parameters
Section titled “Parameters”FunctionDecl
Returns
Section titled “Returns”void