Type Aliases!
This commit is contained in:
parent
32815301fa
commit
25c3ac5c0d
3 changed files with 47 additions and 2 deletions
|
|
@ -715,6 +715,13 @@ export class Parser {
|
|||
|
||||
this.expect('equals');
|
||||
|
||||
// If next token isn't a type-ident, it's a type alias
|
||||
if (this.current().kind !== 'type-ident') {
|
||||
const alias = this.parseType();
|
||||
if (this.current().kind === 'semicolon') this.advance();
|
||||
return { kind: 'type-definition', name, params, constructors: [], alias, ...this.getPos(nameToken) };
|
||||
}
|
||||
|
||||
// Parse constructors separated by |
|
||||
const constructors: TypeConstructor[] = [];
|
||||
constructors.push(this.parseTypeConstructor());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue