From 0eb9b2463db3d2b9515a50d5a44a4adfdb2a7f23 Mon Sep 17 00:00:00 2001 From: mAAdhaTTah Date: Wed, 21 Nov 2018 15:54:26 -0500 Subject: [PATCH] Move plugin check to pipeline op appearance No need to recheck it throughout then. --- packages/babel-parser/src/parser/expression.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index e94dc10805..cd7f402561 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -298,6 +298,7 @@ export default class ExpressionParser extends LValParser { const op = this.state.type; if (op === tt.pipeline) { + this.expectPlugin("pipelineOperator"); this.state.inPipeline = true; this.checkPipelineAtInfixOperator(left, leftStartPos); } else if (op === tt.nullishCoalescing) { @@ -958,7 +959,6 @@ export default class ExpressionParser extends LValParser { case tt.hash: { if (this.state.inPipeline) { - this.expectPlugin("pipelineOperator"); node = this.startNode(); if ( @@ -2034,8 +2034,6 @@ export default class ExpressionParser extends LValParser { // of the infix operator `|>`. checkPipelineAtInfixOperator(left: N.Expression, leftStartPos: number) { - this.expectPlugin("pipelineOperator"); - if (this.getPluginOption("pipelineOperator", "proposal") === "smart") { if (left.type === "SequenceExpression") { // Ensure that the pipeline head is not a comma-delimited