Daniel Tschinder 9eb010da50
Unify reserved word checking and update error messages (#9402)
* Unify reserved word checking and update error messages

* Fix test
2019-01-31 19:02:32 -08:00

27 lines
616 B
JavaScript

// @flow
import type { Options } from "../options";
import type State from "../tokenizer/state";
import type { PluginsMap } from "./index";
export default class BaseParser {
// Properties set by constructor in index.js
options: Options;
inModule: boolean;
plugins: PluginsMap;
filename: ?string;
sawUnambiguousESM: boolean = false;
// Initialized by Tokenizer
state: State;
hasPlugin(name: string): boolean {
return this.plugins.has(name);
}
getPluginOption(plugin: string, name: string) {
// $FlowIssue
if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[name];
}
}