From 20a483cd58718302333409fc2f39df4664b5357c Mon Sep 17 00:00:00 2001 From: Daniel Lo Nigro Date: Sun, 15 Nov 2015 21:29:59 -0800 Subject: [PATCH] Fix Flow. Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow. Closes #3064 --- src/index.js | 2 -- src/options.js | 2 -- src/parser/expression.js | 4 +--- src/parser/index.js | 2 -- src/parser/location.js | 2 -- src/parser/lval.js | 2 -- src/parser/node.js | 2 -- src/parser/statement.js | 2 -- src/plugins/flow.js | 2 -- src/plugins/jsx/index.js | 2 -- src/tokenizer/index.js | 2 -- src/tokenizer/state.js | 2 -- src/tokenizer/types.js | 2 -- src/util/identifier.js | 2 -- src/util/location.js | 2 -- src/util/whitespace.js | 2 +- 16 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/index.js b/src/index.js index b01a0b1197..694c4e4838 100755 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,3 @@ -/* @flow */ - import Parser, { plugins } from "./parser"; import "./parser/util"; import "./parser/statement"; diff --git a/src/options.js b/src/options.js index 7beddde5ad..ecac819f46 100755 --- a/src/options.js +++ b/src/options.js @@ -1,5 +1,3 @@ -/* @flow */ - // A second optional argument can be given to further configure // the parser process. These options are recognized: diff --git a/src/parser/expression.js b/src/parser/expression.js index 2e9847dd19..784eb3a3ea 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -1,5 +1,3 @@ -/* @flow */ - // A recursive descent parser operates by defining functions for all // syntactic elements, and recursively calling those, each function // advancing the input stream and returning an AST node. Precedence @@ -135,7 +133,7 @@ pp.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse) { } else if (failOnShorthandAssign && refShorthandDefaultPos.start) { this.unexpected(refShorthandDefaultPos.start); } - + return left; }; diff --git a/src/parser/index.js b/src/parser/index.js index 6f9e2b3c26..a3492a4b54 100644 --- a/src/parser/index.js +++ b/src/parser/index.js @@ -1,5 +1,3 @@ -/* @flow */ - import { reservedWords } from "../util/identifier"; import { getOptions } from "../options"; import Tokenizer from "../tokenizer"; diff --git a/src/parser/location.js b/src/parser/location.js index 3029551c43..c8f10cc172 100644 --- a/src/parser/location.js +++ b/src/parser/location.js @@ -1,5 +1,3 @@ -/* @flow */ - import { getLineInfo } from "../util/location"; import Parser from "./index"; diff --git a/src/parser/lval.js b/src/parser/lval.js index d655805f5d..895323f8df 100644 --- a/src/parser/lval.js +++ b/src/parser/lval.js @@ -1,5 +1,3 @@ -/* @flow */ - import { types as tt } from "../tokenizer/types"; import Parser from "./index"; import { reservedWords } from "../util/identifier"; diff --git a/src/parser/node.js b/src/parser/node.js index e0dcf33b08..d9e07ae329 100644 --- a/src/parser/node.js +++ b/src/parser/node.js @@ -1,5 +1,3 @@ -/* @flow */ - import Parser from "./index"; import { SourceLocation } from "../util/location"; diff --git a/src/parser/statement.js b/src/parser/statement.js index 710850b555..d86f25bfc3 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -1,5 +1,3 @@ -/* @flow */ - import { types as tt } from "../tokenizer/types"; import Parser from "./index"; import { lineBreak } from "../util/whitespace"; diff --git a/src/plugins/flow.js b/src/plugins/flow.js index ea0c82e080..9a691cbff7 100644 --- a/src/plugins/flow.js +++ b/src/plugins/flow.js @@ -1,5 +1,3 @@ -/* @flow */ - import { types as tt } from "../tokenizer/types"; import Parser from "../parser"; diff --git a/src/plugins/jsx/index.js b/src/plugins/jsx/index.js index 2d466d4ece..28d1ce2ee8 100644 --- a/src/plugins/jsx/index.js +++ b/src/plugins/jsx/index.js @@ -1,5 +1,3 @@ -/* @flow */ - import XHTMLEntities from "./xhtml"; import { TokenType, types as tt } from "../../tokenizer/types"; import { TokContext, types as tc } from "../../tokenizer/context"; diff --git a/src/tokenizer/index.js b/src/tokenizer/index.js index 6ac78e136d..8e610f77dd 100644 --- a/src/tokenizer/index.js +++ b/src/tokenizer/index.js @@ -1,5 +1,3 @@ -/* @flow */ - import type { TokenType } from "./types"; import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier"; import { types as tt, keywords as keywordTypes } from "./types"; diff --git a/src/tokenizer/state.js b/src/tokenizer/state.js index 63107de019..68104ae947 100644 --- a/src/tokenizer/state.js +++ b/src/tokenizer/state.js @@ -1,5 +1,3 @@ -/* @flow */ - import type { TokContext } from "./context"; import type { Token } from "./index"; import { Position } from "../util/location"; diff --git a/src/tokenizer/types.js b/src/tokenizer/types.js index fa8ff99bab..c97e829287 100644 --- a/src/tokenizer/types.js +++ b/src/tokenizer/types.js @@ -1,5 +1,3 @@ -/* @flow */ - // ## Token types // The assignment of fine-grained, information-carrying type objects diff --git a/src/util/identifier.js b/src/util/identifier.js index 09045f8af0..7df2faada3 100644 --- a/src/util/identifier.js +++ b/src/util/identifier.js @@ -1,5 +1,3 @@ -/* @flow */ - // This is a trick taken from Esprima. It turns out that, on // non-Chrome browsers, to check whether a string is in a set, a // predicate containing a big ugly `switch` statement is faster than diff --git a/src/util/location.js b/src/util/location.js index 47019f1068..883d4b3daa 100644 --- a/src/util/location.js +++ b/src/util/location.js @@ -1,5 +1,3 @@ -/* @flow */ - import { lineBreakG } from "./whitespace"; // These are used when `options.locations` is on, for the diff --git a/src/util/whitespace.js b/src/util/whitespace.js index 78d800df7c..50b90c8ca7 100644 --- a/src/util/whitespace.js +++ b/src/util/whitespace.js @@ -6,7 +6,7 @@ export const lineBreak = /\r\n?|\n|\u2028|\u2029/; export const lineBreakG = new RegExp(lineBreak.source, "g"); -export function isNewLine(code) { +export function isNewLine(code: number): boolean { return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; }