icerpc / slicec

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

'Scope' can cleanly handle an absent module declaration. #600

Closed InsertCreativityHere closed 1 year ago

InsertCreativityHere commented 1 year ago

This PR handles the edge case where a user has a doc comment in a file missing it's module declaration. We parse doc comments before we parse the thing they apply to, and when trying to parse the comment we check the scope.

If a user didn't write a module, this will cause a panic.

This PR fixes Scope to be able to cope with this specific edge case. It also adds back the raw_scope function that I accidentally deleted in my last PR...