jamesjuett / lobster

Interactive Program Visualization Tools
8 stars 3 forks source link

Qualified Names, Declarators, Function Declaration/Definition Rework #333

Open jamesjuett opened 2 years ago

jamesjuett commented 2 years ago

This PR is a work-in-progress. This PR significantly reworks the way declarators and function declarations/definitions work, in particular to improve support for qualified names, inline vs. out-of-line definitions, and linking.

It fixes some long-standing bugs in Lobster, including:

All regression tests are currently passing, but more need to be added to thoroughly test the affected parts of compilation as well as new features.

It adds a new construct, DeclaratorName, that serves as an abstraction over parsing an unqualified or qualified name in a declarator. It contains a cleaned up mechanism for assessing whether a declarator names a constructor or destructor, based on the context in which the name occurs.

The Declarator construct is also updated to use DeclaratorName internally and to create a "qualified context" based on both its "occurring context" (i.e. where it lexically occurs in the code) and its "qualified prefix context". This preps for future work in #301.

TODO: recursive functions are broken on this branch