vsl-lang/VSL

Classes and interfaces not parsing properly

Closed this issue · 0 comments

I get the following AST when typing in @Cool public interface Foo {func bar() -> Int}:

[ CodeBlock {
    position: 0,
    parentScope: null,
    parentNode: null,
    queueQualifier: null,
    statements: 
     [ InterfaceStatement {
         position: 0,
         parentScope: null,
         parentNode: null,
         queueQualifier: null,
         access: [ 'public' ],
         name: 
          Identifier {
            position: false,
            parentScope: null,
            parentNode: null,
            queueQualifier: null,
            identifier: ScopeItem { rootId: 'Foo', references: [], type: null } },
         superclasses: null,
         statements: { value: '{' } } ],
    scope: Scope { ids: Map {}, parentScope: null },
    rootScope: true },
  tokens: 14 ]

This is obviously not right, specifically for position: false, statements: { value: '{' } }, and the absence of an annotations array. To prevent weird things like this from happening in the future, our tests should check if the ASTs are valid and not just if the parser can parse it.