Update Flow to 0.123.0 (#11500)

This commit is contained in:
Nicolò Ribaudo
2020-04-30 15:26:03 +02:00
committed by GitHub
parent 96ccf56436
commit 90a9103e55
14 changed files with 82 additions and 81 deletions

View File

@@ -208,6 +208,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
this.directiveToStmt(d),
);
node.body = directiveStatements.concat(node.body);
// $FlowIgnore - directives isn't optional in the type definition
delete node.directives;
}
@@ -389,7 +390,9 @@ export default (superClass: Class<Parser>): Class<Parser> =>
if (node.callee.type === "Import") {
((node: N.Node): N.EstreeImportExpression).type = "ImportExpression";
((node: N.Node): N.EstreeImportExpression).source = node.arguments[0];
// $FlowIgnore - arguments isn't optional in the type definition
delete node.arguments;
// $FlowIgnore - callee isn't optional in the type definition
delete node.callee;
}

View File

@@ -1,5 +1,7 @@
// @flow
/*:: declare var invariant; */
import type { Options } from "../options";
import * as N from "../types";
import type { Position } from "../util/location";
@@ -1360,10 +1362,14 @@ export default class Tokenizer extends LocationParser {
default:
if (ch >= charCodes.digit0 && ch <= charCodes.digit7) {
const codePos = this.state.pos - 1;
// $FlowFixMe
let octalStr = this.input
const match = this.input
.substr(this.state.pos - 1, 3)
.match(/^[0-7]+/)[0];
.match(/^[0-7]+/);
// This is never null, because of the if condition above.
/*:: invariant(match !== null) */
let octalStr = match[0];
let octal = parseInt(octalStr, 8);
if (octal > 255) {
octalStr = octalStr.slice(0, -1);