diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 74f78c6047ac..ca62723b0dca 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -45,6 +45,7 @@ import { ExpressionErrors } from "./util"; export default class ExpressionParser extends LValParser { // Forward-declaration: defined in statement.js + /*:: +parseBlock: ( allowDirectives?: boolean, createNewLexicalScope?: boolean, @@ -63,6 +64,7 @@ export default class ExpressionParser extends LValParser { ) => T; +parseFunctionParams: (node: N.Function, allowModifiers?: boolean) => void; +takeDecorators: (node: N.HasDecorators) => void; + */ // Check if property __proto__ has been used more than once. // If the expression is a destructuring assignment, then __proto__ may appear diff --git a/packages/babel-parser/src/parser/index.js b/packages/babel-parser/src/parser/index.js index d3f5db419c6b..e557afa43f92 100644 --- a/packages/babel-parser/src/parser/index.js +++ b/packages/babel-parser/src/parser/index.js @@ -1,7 +1,7 @@ // @flow import type { Options } from "../options"; -import type { File, JSXOpeningElement } from "../types"; +import type { File /*::, JSXOpeningElement */ } from "../types"; import type { PluginList } from "../plugin-utils"; import { getOptions } from "../options"; import StatementParser from "./statement"; @@ -13,9 +13,11 @@ export type PluginsMap = Map; export default class Parser extends StatementParser { // Forward-declaration so typescript plugin can override jsx plugin + /*:: +jsxParseOpeningElementAfterName: ( node: JSXOpeningElement, ) => JSXOpeningElement; + */ constructor(options: ?Options, input: string) { options = getOptions(options); diff --git a/packages/babel-parser/src/parser/location.js b/packages/babel-parser/src/parser/location.js index 3694a567090a..21c08a581239 100644 --- a/packages/babel-parser/src/parser/location.js +++ b/packages/babel-parser/src/parser/location.js @@ -10,7 +10,10 @@ import CommentsParser from "./comments"; // message. export default class LocationParser extends CommentsParser { + // Forward-declaration: defined in tokenizer/index.js + /*:: +isLookahead: boolean; + */ getLocationForPosition(pos: number): Position { let loc; diff --git a/packages/babel-parser/src/parser/lval.js b/packages/babel-parser/src/parser/lval.js index 51de283f5be7..ce81dccd8c7c 100644 --- a/packages/babel-parser/src/parser/lval.js +++ b/packages/babel-parser/src/parser/lval.js @@ -6,13 +6,13 @@ import type { TSParameterProperty, Decorator, Expression, - Identifier, Node, - ObjectExpression, - ObjectPattern, Pattern, RestElement, SpreadElement, + /*:: Identifier, */ + /*:: ObjectExpression, */ + /*:: ObjectPattern, */ } from "../types"; import type { Pos, Position } from "../util/location"; import { @@ -31,6 +31,7 @@ const unwrapParenthesizedExpression = (node: Node) => { export default class LValParser extends NodeUtils { // Forward-declaration: defined in expression.js + /*:: +parseIdentifier: (liberal?: boolean) => Identifier; +parseMaybeAssign: ( noIn?: ?boolean, @@ -42,8 +43,11 @@ export default class LValParser extends NodeUtils { isPattern: boolean, refExpressionErrors?: ?ExpressionErrors, ) => T; + */ // Forward-declaration: defined in statement.js + /*:: +parseDecorator: () => Decorator; + */ // Convert existing expression atom to assignable pattern // if possible. diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index 8558137f719f..f75ee0acdc5a 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -111,7 +111,9 @@ export class Token { export default class Tokenizer extends LocationParser { // Forward-declarations // parser/util.js + /*:: +unexpected: (pos?: ?number, messageOrType?: string | TokenType) => empty; + */ isLookahead: boolean; diff --git a/packages/babel-parser/src/util/scope.js b/packages/babel-parser/src/util/scope.js index 1cbf06fb671f..9205547b729b 100644 --- a/packages/babel-parser/src/util/scope.js +++ b/packages/babel-parser/src/util/scope.js @@ -92,7 +92,7 @@ export default class ScopeHandler { return new Scope(flags); } // This method will be overwritten by subclasses - +createScope: (flags: ScopeFlags) => IScope; + /*:: +createScope: (flags: ScopeFlags) => IScope; */ enter(flags: ScopeFlags) { this.scopeStack.push(this.createScope(flags));