class Mint::Scope
- Mint::Scope
- Reference
- Object
Overview
The class is responsible for keeping track of which variable is pointing to which node.
The data strucutre is a tree where leafs are the levels of the child nodes of an AST node and a level is a container for the possible targets.
When resolving a variable we travese it's tree upwards to find the target which matches the value of the variable.
Defined in:
scope.crConstructors
Instance Method Summary
-
#add(node : Ast::Node, key : String, value : Ast::Node)
Adds a target to the level of the given node.
- #build(node : Ast::Node | Nil, parent : Ast::Node)
-
#build(nodes : Array(Ast::Node), parent : Ast::Node, *, stack : Bool = false)
Builds an array of nodes.
-
#build(node : Ast::Node)
Builds the scope for the given node and it's child nodes.
-
#create(node : Ast::Node, parent : Ast::Node | Nil = nil)
Builds a level for the node and yields the parents scope.
-
#nodes : Hash(Mint::Ast::Node, Mint::Scope::Level)
We track the level of a node in here.
- #resolve(target : String, base : Ast::Node)
-
#resolve(node : Ast::Variable)
Tries to find the target of the given variable.
-
#resolve
Resolves the targets which can be statically resolved, currently only the exposed variables of a connected store in a component.
- #root : Mint::Scope::Level
-
#scopes : Hash(Mint::Ast::Node, Array(Mint::Scope::Level))
We track the level stack of a node in here.
Constructor Detail
Instance Method Detail
Adds a target to the level of the given node.
Builds an array of nodes. If stack
is true
then each node will be the
child of the previous nodes.
Builds the scope for the given node and it's child nodes.
Builds a level for the node and yields the parents scope.
We track the level of a node in here.
Resolves the targets which can be statically resolved, currently only the exposed variables of a connected store in a component.
We track the level stack of a node in here.