icerpc / slicec

The Slice compiler library
Apache License 2.0
13 stars 5 forks source link

Finish Changes to Module Syntax #597

Closed InsertCreativityHere closed 1 year ago

InsertCreativityHere commented 1 year ago

This PR finishes the new API for modules.

Now Module::identifier only returns the actual identifier, instead of all the modules it's nested within too. Example:

module Foo::Bar

/* old */ module.identifier() == "Foo::Bar"
/* new */ module.identifier() == "Bar"

The fully scoped module is exposed through a new nested_module_identifier function for where we need it.


It also rewrites the Scope struct. Previously it had 2 vectors, one for modules scopes and one for parser scopes, but it's been rewritten to take advantage of the fact that we know the full module scope up-front now.

I also added a get_module function to it. This will allow elements to navigate to their module to check for attributes like cs::namespace.