pxp-lang / pxp

A suite of high-performance tools for PHP developers – includes a code formatter, static analyser, language server and superset language.
https://pxplang.org
Other
784 stars 0 forks source link

Introduce a `ScopeAwareVisitor` #41

Closed ryangjchandler closed 6 months ago

ryangjchandler commented 9 months ago

There are multiple scenarios where we want to traverse an AST and keep track of scope information, e.g. indexing, type-resolving & type-checking, and autocompletion.

Instead of duplicating a bunch of spaghetti code across various crates, we should instead introduce a ScopeAwareVisitor that handles the scope tracking for us with some default method implementations, then we can override the methods that we care about.

The information that we care about is:

Then some helper methods for getting scope info too:

ryangjchandler commented 6 months ago

Closing in favour of #55.