Skip to content

Commit

Permalink
Fix parser bug after interface statement. (#493)
Browse files Browse the repository at this point in the history
* Fix bug breaking parser after interface statement.

* fix formatting issue
  • Loading branch information
TwitchBronBron authored Jan 25, 2022
1 parent d6cff91 commit e6a52bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/parser/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ export class Parser {
//consume the final `end interface` token
const endInterfaceToken = this.consumeToken(TokenKind.EndInterface);

this.consumeStatementSeparators();

const statement = new InterfaceStatement(
interfaceToken,
nameToken,
Expand Down
15 changes: 14 additions & 1 deletion src/parser/tests/statement/InterfaceStatement.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTestGetTypedef } from '../../../testHelpers.spec';
import { expectZeroDiagnostics, getTestGetTypedef } from '../../../testHelpers.spec';
import { standardizePath as s } from '../../../util';
import { Program } from '../../../Program';

Expand Down Expand Up @@ -61,4 +61,17 @@ describe('InterfaceStatement', () => {
end interface
`, undefined, undefined, undefined, true);
});

it('allows declaring multiple interfaces in a file', () => {
program.addOrReplaceFile('source/interfaces.bs', `
interface Iface1
name as dynamic
end interface
interface IFace2
prop as dynamic
end interface
`);
program.validate();
expectZeroDiagnostics(program);
});
});

0 comments on commit e6a52bc

Please sign in to comment.