Fix type check errors (#521)
This commit is contained in:
parent
d95b5fb83d
commit
aa78011666
@ -665,7 +665,8 @@ export default class ExpressionParser extends LValParser {
|
||||
}
|
||||
}
|
||||
|
||||
parseParenItem(node: N.Expression): N.Expression {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
parseParenItem(node: N.Expression, startPos: number, startLoc: Position): N.Expression {
|
||||
return node;
|
||||
}
|
||||
|
||||
@ -705,6 +706,7 @@ export default class ExpressionParser extends LValParser {
|
||||
const elem = this.startNode();
|
||||
if (this.state.value === null) {
|
||||
if (!isTagged) {
|
||||
// $FlowFixMe
|
||||
this.raise(this.state.invalidTemplateEscapePosition, "Invalid escape sequence in template");
|
||||
} else {
|
||||
this.state.invalidTemplateEscapePosition = null;
|
||||
@ -846,7 +848,7 @@ export default class ExpressionParser extends LValParser {
|
||||
this.match(tt.num) || // get 1() {}
|
||||
this.match(tt.bracketL) || // get ["string"]() {}
|
||||
this.match(tt.name) || // get foo() {}
|
||||
this.state.type.keyword // get debugger() {}
|
||||
!!this.state.type.keyword // get debugger() {}
|
||||
);
|
||||
}
|
||||
|
||||
@ -1036,7 +1038,7 @@ export default class ExpressionParser extends LValParser {
|
||||
// nothing in between them to be parsed as `null` (which is needed
|
||||
// for array literals).
|
||||
|
||||
parseExprList(close: TokenType, allowEmpty?: boolean, refShorthandDefaultPos?: Pos): $ReadOnlyArray<?N.Expression> {
|
||||
parseExprList(close: TokenType, allowEmpty?: boolean, refShorthandDefaultPos?: ?Pos): $ReadOnlyArray<?N.Expression> {
|
||||
const elts = [];
|
||||
let first = true;
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
// complexity.
|
||||
|
||||
switch (starttype) {
|
||||
// $FlowFixMe
|
||||
case tt._break: case tt._continue: return this.parseBreakContinueStatement(node, starttype.keyword);
|
||||
case tt._debugger: return this.parseDebuggerStatement(node);
|
||||
case tt._do: return this.parseDoStatement(node);
|
||||
@ -554,6 +555,7 @@ export default class StatementParser extends ExpressionParser {
|
||||
|
||||
parseVar(node: N.VariableDeclaration, isFor: boolean, kind: TokenType): N.VariableDeclaration {
|
||||
const declarations = node.declarations = [];
|
||||
// $FlowFixMe
|
||||
node.kind = kind.keyword;
|
||||
for (;;) {
|
||||
const decl = this.startNode();
|
||||
@ -887,7 +889,8 @@ export default class StatementParser extends ExpressionParser {
|
||||
return this.finishNode(node, "ExportNamedDeclaration");
|
||||
}
|
||||
|
||||
parseExportDeclaration(): N.Declaration {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
parseExportDeclaration(node: N.ExportNamedDeclaration): ?N.Declaration {
|
||||
return this.parseStatement(true);
|
||||
}
|
||||
|
||||
|
||||
@ -132,10 +132,11 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
delete node.directives;
|
||||
}
|
||||
|
||||
parseClassMethod(classBody, ...args) {
|
||||
parseClassMethod(classBody: N.ClassBody, ...args) {
|
||||
super.parseClassMethod(classBody, ...args);
|
||||
|
||||
const body = classBody.body;
|
||||
// $FlowIgnore
|
||||
body[body.length - 1].type = "MethodDefinition";
|
||||
}
|
||||
|
||||
@ -185,7 +186,9 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
const node = super.parseObjectMethod(...args);
|
||||
|
||||
if (node) {
|
||||
// $FlowIgnore
|
||||
if (node.kind === "method") node.kind = "init";
|
||||
// $FlowIgnore
|
||||
node.type = "Property";
|
||||
}
|
||||
|
||||
@ -196,7 +199,9 @@ export default (superClass: Class<Parser>): Class<Parser> => class extends super
|
||||
const node = super.parseObjectProperty(...args);
|
||||
|
||||
if (node) {
|
||||
// $FlowIgnore
|
||||
node.kind = "init";
|
||||
// $FlowIgnore
|
||||
node.type = "Property";
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user