Wrap type-only class fields in flow comments (#11096)
* Wrap type-only class fields in flow comments * Fix
This commit is contained in:
parent
dadba01249
commit
8ab27c8ffe
@ -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
|
||||
|
||||
@ -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<string, { [string]: any }>;
|
||||
|
||||
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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ export default class ScopeHandler<IScope: Scope = Scope> {
|
||||
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));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user