fix(compiler): fix types
This commit is contained in:
parent
9c3386b1b7
commit
7ae8ad6aab
|
@ -290,24 +290,24 @@ export class _ParseAST {
|
||||||
this.error(`Missing expected operator ${operator}`);
|
this.error(`Missing expected operator ${operator}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
expectIdentifierOrKeyword(): string|null {
|
expectIdentifierOrKeyword(): string {
|
||||||
const n = this.next;
|
const n = this.next;
|
||||||
if (!n.isIdentifier() && !n.isKeyword()) {
|
if (!n.isIdentifier() && !n.isKeyword()) {
|
||||||
this.error(`Unexpected token ${n}, expected identifier or keyword`);
|
this.error(`Unexpected token ${n}, expected identifier or keyword`);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
this.advance();
|
this.advance();
|
||||||
return n.toString();
|
return n.toString() as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
expectIdentifierOrKeywordOrString(): string|null {
|
expectIdentifierOrKeywordOrString(): string {
|
||||||
const n = this.next;
|
const n = this.next;
|
||||||
if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
|
if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
|
||||||
this.error(`Unexpected token ${n}, expected identifier, keyword, or string`);
|
this.error(`Unexpected token ${n}, expected identifier, keyword, or string`);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
this.advance();
|
this.advance();
|
||||||
return n.toString();
|
return n.toString() as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseChain(): AST {
|
parseChain(): AST {
|
||||||
|
@ -340,7 +340,7 @@ export class _ParseAST {
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const name = this.expectIdentifierOrKeyword() !;
|
const name = this.expectIdentifierOrKeyword();
|
||||||
const args: AST[] = [];
|
const args: AST[] = [];
|
||||||
while (this.optionalCharacter(chars.$COLON)) {
|
while (this.optionalCharacter(chars.$COLON)) {
|
||||||
args.push(this.parseExpression());
|
args.push(this.parseExpression());
|
||||||
|
@ -612,7 +612,7 @@ export class _ParseAST {
|
||||||
if (!this.optionalCharacter(chars.$RBRACE)) {
|
if (!this.optionalCharacter(chars.$RBRACE)) {
|
||||||
this.rbracesExpected++;
|
this.rbracesExpected++;
|
||||||
do {
|
do {
|
||||||
const key = this.expectIdentifierOrKeywordOrString() !;
|
const key = this.expectIdentifierOrKeywordOrString();
|
||||||
keys.push(key);
|
keys.push(key);
|
||||||
this.expectCharacter(chars.$COLON);
|
this.expectCharacter(chars.$COLON);
|
||||||
values.push(this.parsePipe());
|
values.push(this.parsePipe());
|
||||||
|
@ -625,7 +625,7 @@ export class _ParseAST {
|
||||||
|
|
||||||
parseAccessMemberOrMethodCall(receiver: AST, isSafe: boolean = false): AST {
|
parseAccessMemberOrMethodCall(receiver: AST, isSafe: boolean = false): AST {
|
||||||
const start = receiver.span.start;
|
const start = receiver.span.start;
|
||||||
const id = this.expectIdentifierOrKeyword() !;
|
const id = this.expectIdentifierOrKeyword();
|
||||||
|
|
||||||
if (this.optionalCharacter(chars.$LPAREN)) {
|
if (this.optionalCharacter(chars.$LPAREN)) {
|
||||||
this.rparensExpected++;
|
this.rparensExpected++;
|
||||||
|
|
Loading…
Reference in New Issue