Skip to main content

Module scopes

Module scopes 

Source
Expand description

Environment stack operations - scope management and slot-indexed value access.

The environment is a Vec<Vec<EnvironmentItem>> - a stack of frames. Each frame is a flat vec of slots indexed by the resolver’s slot numbers. Depth 0 = current frame, depth 1 = one scope up, etc.

Globals live in a separate self.globals field, addressed when depth points past the end of the local environment stack. This keeps globals from ever needing to be cloned in/out on function calls.