Merge pull request #8289 from valtech-nyc/implement-smart-pipeline-in-parser

Implement Smart Pipeline proposal in @babel/parser
This commit is contained in:
Sven Sauleau
2018-12-03 19:28:45 +01:00
committed by GitHub
158 changed files with 8496 additions and 86 deletions

View File

@@ -6,7 +6,7 @@ import { Position } from "../util/location";
import { types as ct, type TokContext } from "./context";
import type { Token } from "./index";
import { types as tt, type TokenType } from "./types";
import { types as tt, type TokenType, type TopicContextState } from "./types";
export default class State {
init(options: Options, input: string): void {
@@ -26,6 +26,7 @@ export default class State {
this.maybeInArrowParameters = false;
this.inGenerator = false;
this.inAsync = false;
this.inPipeline = false;
this.inPropertyName = false;
this.inType = false;
this.inClassProperty = false;
@@ -33,6 +34,12 @@ export default class State {
this.hasFlowComment = false;
this.isIterator = false;
// Used by smartPipelines.
this.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null,
};
this.classLevel = 0;
this.labels = [];
@@ -104,6 +111,7 @@ export default class State {
inGenerator: boolean;
inMethod: boolean | N.MethodKind;
inAsync: boolean;
inPipeline: boolean;
inType: boolean;
noAnonFunctionType: boolean;
inPropertyName: boolean;
@@ -111,6 +119,9 @@ export default class State {
hasFlowComment: boolean;
isIterator: boolean;
// For the smartPipelines plugin:
topicContext: TopicContextState;
// Check whether we are in a (nested) class or not.
classLevel: number;