diff --git a/src/parser/expression.js b/src/parser/expression.js index 242a390564..23f6875077 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -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 { + parseExprList(close: TokenType, allowEmpty?: boolean, refShorthandDefaultPos?: ?Pos): $ReadOnlyArray { const elts = []; let first = true; diff --git a/src/parser/statement.js b/src/parser/statement.js index 153b614ce0..f29b2c29a3 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -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); } diff --git a/src/plugins/estree.js b/src/plugins/estree.js index e4b7041774..347d325378 100644 --- a/src/plugins/estree.js +++ b/src/plugins/estree.js @@ -132,10 +132,11 @@ export default (superClass: Class): Class => 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): Class => 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): Class => class extends super const node = super.parseObjectProperty(...args); if (node) { + // $FlowIgnore node.kind = "init"; + // $FlowIgnore node.type = "Property"; }