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

TypeMap: Introduce a new TypeMap component #30

Closed ryangjchandler closed 9 months ago

ryangjchandler commented 11 months ago

Closes #27.

ryangjchandler commented 10 months ago

The main goal right now is finding a good way to share some name resolution logic and scope tracking between the Indexer component and the TypeMapGenerator component.

Both of them need to do some work to qualify identifiers and symbols, but they have access to different things. My plan is to use a separate NameResolvingVisitor that will resolve names separately and work with both of them.

It will require multiple AST traversals, but I don't think that's a problem since the traversal doesn't touch much and can be super fast.

I'm also thinking about further expanding on identifiers, such that Qualified and FullyQualified identifiers are represented by multiple Symbol values, as well as a larger unified Symbol. This would make things like alias resolution much simpler as I wouldn't have to do this on-demand.