Skip to content

Traverse enter scope after enter_*, exit before exit_* #4200

@overlookmotel

Description

@overlookmotel

Currently Traverse's timing of entering and exiting scopes is different for different node types. It depends on whether the scope covers all fields, or only a subset.

  • If scope starts after some fields, scope is entered after enter_* and exited before exit_*.
  • If scope covers whole node, scope is entered before enter_* and exited after exit_*.

This means enter_* and exit_* for any node are always called with same scope at top of the scope stack. Good.

But the fact that current scope in enter_* and exit_* is different depending on the node makes it confusing.

Change this to be consistent for all node types:

  • Always enter the scope after enter_*.
  • Always exit the scope before exit_*.

If they need it, enter_* / exit_* can get the node's ScopeId from the node's scope_id field.

Metadata

Metadata

Assignees

Labels

P-highPriority - High

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions