Metadata - Scope & Symbol State
NOTE: we're not storing symbols in Block, Method, Struct explicitly, since it is causing huge AST-rewrites on updates.
To avoid rewrites, it is possible to use mutable Block, Method, Struct, but we want to avoid it to enable better traceability of mutations.
- Value parameters:
- astScopes
Scope, AST refers to; { AST -> Scope } -- parent scope for AST
- methodArgs
Arguments that belong to a method; { Method -> List[Var] } NOTE: We use
List[Var]
and NOT a Set to maintain the order Vars were added.- methodAsts
AST, a Symbol references; { Symbol -> AST }
- methodRetTypes
Return Type, associated with a method; { Method -> Type }
- scopeSymbols
All symbols that belong to a scope; { Scope -> List[Symbol] } NOTE: We use
List[Symbol]
and NOT a Set to maintain the order Symbols were added.- scopeTree
Scope tree where a child Scope points to a parent Scope (child -> parent)
- symbolScopes
Scope a Symbol belongs to; { Symbol -> Scope }
- varTypes
Type, assigned to a variable { Var -> Type }. A Type for the variable might be changed, e.g.
auto
->long
.
- Companion:
- object
Value members
Concrete methods
Defines a root Scope, not connected to any parent Scope
Defines a root Scope, not connected to any parent Scope
NOTE: it could be multiple Scopes, not connected to the parent, but the use-case for that is not clear.
Defines a BuiltInType
Defines a BuiltInType
NOTE: a BuiltInType might be defined only in Block-scope.
Defines a Method in the given Scope
Defines a Method in the given Scope
NOTE: a Method is a symbol as well.
Defines a method argument (used to have an ordered list of arguments)
Defines a method argument (used to have an ordered list of arguments)
Defines a Struct in the given Scope
Defines a Struct in the given Scope
NOTE: a Struct is a symbol as well.
Defines a Variable Symbol with the given Type. If the variable is already exists, redefines it.
Defines a Variable Symbol with the given Type. If the variable is already exists, redefines it.
Gets a Map { SVar -> Type} for the arguments of a Method
Gets a Map { SVar -> Type} for the arguments of a Method
Resolve a symbol in the scope recursively up to the root
Resolve a symbol in the scope recursively up to the root