Members
length
Gets the number of variable declarators in the scope.
- Source:
Methods
add(name)
Adds a variable to the scope.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
- Source:
buildDeclaration() → {VariableDeclaration}
Builds the variable declaration for the scope.
- Source:
Returns:
- The built variable declaration.
- Type
- VariableDeclaration
has(name) → {boolean}
Checks if a variable is declared in the scope.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
- Source:
Returns:
- True if the variable is declared, false otherwise.
- Type
- boolean
lookup(name) → {Scope|null}
Looks up a variable in the scope and its parent scopes.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
- Source:
Returns:
- The scope where the variable is declared, or null if not found.
- Type
- Scope | null
notDeclared() → {Set.<string>}
Finds variables that are used but not declared in the scope.
- Source:
Returns:
- The set of not declared variables.
- Type
- Set.<string>
notDeclaredMessage() → {string|null}
Generates a message for not declared variables in the scope.
- Source:
Returns:
- The message for not declared variables, or null if all variables are declared.
- Type
- string | null
setAsInitialized(name)
Sets a variable as initialized in the scope.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
- Source:
setAsUsed(name)
Sets a variable as used in the scope.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the variable. |
- Source: