Avoid lookahead when parsing pipeline

The error message is worse, but it is much more performant.
This commit is contained in:
James DiGioia 2018-04-26 18:21:24 -04:00 committed by Nicolò Ribaudo
parent 7142a79eb9
commit 71fd37067e
2 changed files with 1 additions and 10 deletions

View File

@ -310,15 +310,6 @@ export default class ExpressionParser extends LValParser {
const startLoc = this.state.startLoc;
if (op === tt.pipeline) {
const lookahead = this.lookahead();
if (lookahead.type === tt.arrow) {
throw this.raise(
this.state.start,
`Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized`, // eslint-disable-line
);
}
if (
this.match(tt.name) &&
this.state.value === "await" &&

View File

@ -1,4 +1,4 @@
{
"plugins": ["pipelineOperator"],
"throws": "Unexpected arrow \"=>\" after pipeline body; arrow function in pipeline body must be parenthesized (1:6)"
"throws": "Unexpected token, expected \";\" (1:8)"
}