Fix flowtype and add inType to state (#189)

this improves the performance slightly
This commit is contained in:
Daniel Tschinder 2016-10-17 16:45:46 +02:00 committed by Henry Zhu
parent 01e984fd0f
commit 0d72a89df6

View File

@ -1,5 +1,5 @@
import type { TokContext } from "./context";
import type { Token } from "./index";
import type { TokenType } from "./types";
import { Position } from "../util/location";
import { types as ct } from "./context";
import { types as tt } from "./types";
@ -12,7 +12,7 @@ export default class State {
this.potentialArrowAt = -1;
this.inMethod = this.inFunction = this.inGenerator = this.inAsync = false;
this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inType = false;
this.labels = [];
@ -61,6 +61,8 @@ export default class State {
inFunction: boolean;
inGenerator: boolean;
inMethod: boolean;
inAsync: boolean;
inType: boolean;
// Labels in scope.
labels: Array<Object>;
@ -86,7 +88,7 @@ export default class State {
// Properties of the current token:
// Its type
type: Token;
type: TokenType;
// For tokens that include more information than their type, the value
value: any;