Fix module paths not being parsed in type reference expressions
This commit is contained in:
parent
cea177e4a6
commit
9dc62d0836
2 changed files with 14 additions and 2 deletions
|
@ -1068,7 +1068,7 @@ export class ReferenceTypeExpression extends SyntaxBase {
|
||||||
public readonly kind = SyntaxKind.ReferenceTypeExpression;
|
public readonly kind = SyntaxKind.ReferenceTypeExpression;
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
public modulePath: Array<[Identifier, Dot]>,
|
public modulePath: Array<[IdentifierAlt, Dot]>,
|
||||||
public name: IdentifierAlt,
|
public name: IdentifierAlt,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
import { warn } from "console";
|
||||||
import {
|
import {
|
||||||
ReferenceTypeExpression,
|
ReferenceTypeExpression,
|
||||||
SourceFile,
|
SourceFile,
|
||||||
|
@ -172,8 +173,19 @@ export class Parser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public parseReferenceTypeExpression(): ReferenceTypeExpression {
|
public parseReferenceTypeExpression(): ReferenceTypeExpression {
|
||||||
|
const modulePath = [];
|
||||||
|
for (;;) {
|
||||||
|
const t1 = this.peekToken(1);
|
||||||
|
const t2 = this.peekToken(2);
|
||||||
|
if (t1.kind !== SyntaxKind.IdentifierAlt || t2.kind !== SyntaxKind.Dot) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.getToken();
|
||||||
|
this.getToken();
|
||||||
|
modulePath.push([t1, t2] as [IdentifierAlt, Dot]);
|
||||||
|
}
|
||||||
const name = this.expectToken(SyntaxKind.IdentifierAlt);
|
const name = this.expectToken(SyntaxKind.IdentifierAlt);
|
||||||
return new ReferenceTypeExpression([], name);
|
return new ReferenceTypeExpression(modulePath, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public parsePrimitiveTypeExpression(): TypeExpression {
|
public parsePrimitiveTypeExpression(): TypeExpression {
|
||||||
|
|
Loading…
Reference in a new issue