ScopeContext class
Defined in module l0_scope_context (l0_scope_context.py).
Tracks variables and cleanup requirements for a single lexical scope.
Public static attributes
- static List owned_vars
- static List declared_vars
- static Optional parent
- static Optional with_cleanup_inline
- static Optional with_cleanup_block
- static bool with_cleanup_in_progress
Public functions
- auto add_owned(self, str var_name, Type var_type) -> None
- Mark a variable as owned (requiring cleanup) and declared.
- auto add_declared(self, str var_name, Type var_type) -> None
- Mark a variable as declared for type lookup only.
- auto remove_owned(self, str var_name) -> None
- Remove a variable from the owned set.
Public attributes
Function documentation
None l0_scope_context:: ScopeContext:: add_declared(self,
str var_name,
Type var_type)
Mark a variable as declared for type lookup only.
| Parameters | |
|---|---|
| var_name | The (mangled) name of the variable. |
| var_type | The L0 Type of the variable. |
Used for function parameters and pattern variables, which are managed by the caller or scrutinee and do not require cleanup within the current scope.
None l0_scope_context:: ScopeContext:: remove_owned(self,
str var_name)
Remove a variable from the owned set.
| Parameters | |
|---|---|
| var_name | The (mangled) name of the variable to stop tracking. |