From 20a70a296e41e3474beb95f1e5838d5b420d8677 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Thu, 28 Sep 2017 08:57:32 -0400 Subject: [PATCH] pipelineOperator proposal --- README.md | 1 + ast/spec.md | 1 + src/parser/expression.js | 7 + src/tokenizer/index.js | 11 +- src/tokenizer/types.js | 3 +- .../pipeline-operator/base/actual.js | 1 + .../pipeline-operator/base/expected.json | 99 +++++++ .../pipeline-operator/base/options.json | 3 + .../pipeline-operator/chain/actual.js | 1 + .../pipeline-operator/chain/expected.json | 170 +++++++++++ .../pipeline-operator/chain/options.json | 3 + .../pipeline-operator/multiline/actual.js | 4 + .../pipeline-operator/multiline/expected.json | 203 +++++++++++++ .../pipeline-operator/multiline/options.json | 3 + .../pipeline-operator/no-plugin/actual.js | 1 + .../pipeline-operator/no-plugin/options.json | 3 + .../pipeline-operator/precedence/actual.js | 2 + .../precedence/expected.json | 272 ++++++++++++++++++ .../pipeline-operator/precedence/options.json | 3 + .../pipeline-operator/with-arrow/actual.js | 1 + .../with-arrow/expected.json | 176 ++++++++++++ .../pipeline-operator/with-arrow/options.json | 3 + 22 files changed, 968 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/experimental/pipeline-operator/base/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/base/expected.json create mode 100644 test/fixtures/experimental/pipeline-operator/base/options.json create mode 100644 test/fixtures/experimental/pipeline-operator/chain/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/chain/expected.json create mode 100644 test/fixtures/experimental/pipeline-operator/chain/options.json create mode 100644 test/fixtures/experimental/pipeline-operator/multiline/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/multiline/expected.json create mode 100644 test/fixtures/experimental/pipeline-operator/multiline/options.json create mode 100644 test/fixtures/experimental/pipeline-operator/no-plugin/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/no-plugin/options.json create mode 100644 test/fixtures/experimental/pipeline-operator/precedence/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/precedence/expected.json create mode 100644 test/fixtures/experimental/pipeline-operator/precedence/options.json create mode 100644 test/fixtures/experimental/pipeline-operator/with-arrow/actual.js create mode 100644 test/fixtures/experimental/pipeline-operator/with-arrow/expected.json create mode 100644 test/fixtures/experimental/pipeline-operator/with-arrow/options.json diff --git a/README.md b/README.md index 3f53ee6faa..a52b15b344 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ require("babylon").parse("code", { | `bigInt` ([proposal](https://github.com/tc39/proposal-bigint)) | `100n` | | `optionalCatchBinding` ([proposal](https://github.com/babel/proposals/issues/7)) | `try {throw 0;} catch{do();}` | | `throwExpressions` ([proposal](https://github.com/babel/proposals/issues/23)) | `() => throw new Error("")` | +| `pipelineOperator` ([proposal](https://github.com/babel/proposals/issues/29)) | `a |> b` | ### FAQ diff --git a/ast/spec.md b/ast/spec.md index 28695b477a..00703e5c69 100644 --- a/ast/spec.md +++ b/ast/spec.md @@ -790,6 +790,7 @@ enum BinaryOperator { | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in" | "instanceof" + | "|>" } ``` diff --git a/src/parser/expression.js b/src/parser/expression.js index dc392e6d23..58776bb6f3 100644 --- a/src/parser/expression.js +++ b/src/parser/expression.js @@ -290,6 +290,13 @@ export default class ExpressionParser extends LValParser { const startPos = this.state.start; const startLoc = this.state.startLoc; + + if (node.operator === "|>") { + this.expectPlugin("pipelineOperator"); + // Support syntax such as 10 |> x => x + 1 + this.state.potentialArrowAt = startPos; + } + node.right = this.parseExprOp( this.parseMaybeUnary(), startPos, diff --git a/src/tokenizer/index.js b/src/tokenizer/index.js index aa0058e2f3..072cbe3bee 100644 --- a/src/tokenizer/index.js +++ b/src/tokenizer/index.js @@ -411,9 +411,16 @@ export default class Tokenizer extends LocationParser { const next = this.input.charCodeAt(this.state.pos + 1); if (next === code) return this.finishOp(code === 124 ? tt.logicalOR : tt.logicalAND, 2); + if (code === 124) { + // '|>' + if (next === 62) { + return this.finishOp(tt.pipeline, 2); + } else if (next === 125 && this.hasPlugin("flow")) { + // '|}' + return this.finishOp(tt.braceBarR, 2); + } + } if (next === 61) return this.finishOp(tt.assign, 2); - if (code === 124 && next === 125 && this.hasPlugin("flow")) - return this.finishOp(tt.braceBarR, 2); return this.finishOp(code === 124 ? tt.bitwiseOR : tt.bitwiseAND, 1); } diff --git a/src/tokenizer/types.js b/src/tokenizer/types.js index 83f0bb0719..ee8747ba9d 100644 --- a/src/tokenizer/types.js +++ b/src/tokenizer/types.js @@ -61,7 +61,7 @@ export class TokenType { this.isAssign = !!conf.isAssign; this.prefix = !!conf.prefix; this.postfix = !!conf.postfix; - this.binop = conf.binop || null; + this.binop = conf.binop === 0 ? 0 : conf.binop || null; this.updateContext = null; } } @@ -131,6 +131,7 @@ export const types: { [name: string]: TokenType } = { incDec: new TokenType("++/--", { prefix, postfix, startsExpr }), bang: new TokenType("!", { beforeExpr, prefix, startsExpr }), tilde: new TokenType("~", { beforeExpr, prefix, startsExpr }), + pipeline: new BinopTokenType("|>", 0), logicalOR: new BinopTokenType("||", 1), logicalAND: new BinopTokenType("&&", 2), bitwiseOR: new BinopTokenType("|", 3), diff --git a/test/fixtures/experimental/pipeline-operator/base/actual.js b/test/fixtures/experimental/pipeline-operator/base/actual.js new file mode 100644 index 0000000000..cf3443941f --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/base/actual.js @@ -0,0 +1 @@ +a |> b diff --git a/test/fixtures/experimental/pipeline-operator/base/expected.json b/test/fixtures/experimental/pipeline-operator/base/expected.json new file mode 100644 index 0000000000..f50e52f418 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/base/expected.json @@ -0,0 +1,99 @@ +{ + "type": "File", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/pipeline-operator/base/options.json b/test/fixtures/experimental/pipeline-operator/base/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/base/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +} diff --git a/test/fixtures/experimental/pipeline-operator/chain/actual.js b/test/fixtures/experimental/pipeline-operator/chain/actual.js new file mode 100644 index 0000000000..894495272a --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/chain/actual.js @@ -0,0 +1 @@ +x => x |> inc |> double diff --git a/test/fixtures/experimental/pipeline-operator/chain/expected.json b/test/fixtures/experimental/pipeline-operator/chain/expected.json new file mode 100644 index 0000000000..70ad3a44d7 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/chain/expected.json @@ -0,0 +1,170 @@ +{ + "type": "File", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BinaryExpression", + "start": 5, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "left": { + "type": "BinaryExpression", + "start": 5, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "inc" + }, + "name": "inc" + } + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + }, + "identifierName": "double" + }, + "name": "double" + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/pipeline-operator/chain/options.json b/test/fixtures/experimental/pipeline-operator/chain/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/chain/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +} diff --git a/test/fixtures/experimental/pipeline-operator/multiline/actual.js b/test/fixtures/experimental/pipeline-operator/multiline/actual.js new file mode 100644 index 0000000000..bf01c2aef1 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/multiline/actual.js @@ -0,0 +1,4 @@ +let result = "hello" + |> doubleSay + |> capitalize + |> exclaim; diff --git a/test/fixtures/experimental/pipeline-operator/multiline/expected.json b/test/fixtures/experimental/pipeline-operator/multiline/expected.json new file mode 100644 index 0000000000..5b2a0a70bd --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/multiline/expected.json @@ -0,0 +1,203 @@ +{ + "type": "File", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "sourceType": "script", + "body": [ + { + "type": "VariableDeclaration", + "start": 0, + "end": 65, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "id": { + "type": "Identifier", + "start": 4, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 4 + }, + "end": { + "line": 1, + "column": 10 + }, + "identifierName": "result" + }, + "name": "result" + }, + "init": { + "type": "BinaryExpression", + "start": 13, + "end": 64, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "left": { + "type": "BinaryExpression", + "start": 13, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "left": { + "type": "BinaryExpression", + "start": 13, + "end": 35, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "left": { + "type": "StringLiteral", + "start": 13, + "end": 20, + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + }, + "extra": { + "rawValue": "hello", + "raw": "\"hello\"" + }, + "value": "hello" + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 26, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 14 + }, + "identifierName": "doubleSay" + }, + "name": "doubleSay" + } + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 41, + "end": 51, + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "capitalize" + }, + "name": "capitalize" + } + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "exclaim" + }, + "name": "exclaim" + } + } + } + ], + "kind": "let" + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/pipeline-operator/multiline/options.json b/test/fixtures/experimental/pipeline-operator/multiline/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/multiline/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +} diff --git a/test/fixtures/experimental/pipeline-operator/no-plugin/actual.js b/test/fixtures/experimental/pipeline-operator/no-plugin/actual.js new file mode 100644 index 0000000000..cf3443941f --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/no-plugin/actual.js @@ -0,0 +1 @@ +a |> b diff --git a/test/fixtures/experimental/pipeline-operator/no-plugin/options.json b/test/fixtures/experimental/pipeline-operator/no-plugin/options.json new file mode 100644 index 0000000000..0a8f05f84b --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/no-plugin/options.json @@ -0,0 +1,3 @@ +{ + "throws": "This experimental syntax requires enabling the parser plugin: 'pipelineOperator' (1:5)" +} diff --git a/test/fixtures/experimental/pipeline-operator/precedence/actual.js b/test/fixtures/experimental/pipeline-operator/precedence/actual.js new file mode 100644 index 0000000000..2a79fb405e --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/precedence/actual.js @@ -0,0 +1,2 @@ +4 || 9 |> inc; +10 |> f || h |> inc diff --git a/test/fixtures/experimental/pipeline-operator/precedence/expected.json b/test/fixtures/experimental/pipeline-operator/precedence/expected.json new file mode 100644 index 0000000000..054a9a9dad --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/precedence/expected.json @@ -0,0 +1,272 @@ +{ + "type": "File", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 34, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 14 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "left": { + "type": "LogicalExpression", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 1, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 1 + } + }, + "extra": { + "rawValue": 4, + "raw": "4" + }, + "value": 4 + }, + "operator": "||", + "right": { + "type": "NumericLiteral", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + } + }, + "extra": { + "rawValue": 9, + "raw": "9" + }, + "value": 9 + } + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 10, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "inc" + }, + "name": "inc" + } + } + }, + { + "type": "ExpressionStatement", + "start": 15, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 15, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "left": { + "type": "BinaryExpression", + "start": 15, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "left": { + "type": "NumericLiteral", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "LogicalExpression", + "start": 21, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "left": { + "type": "Identifier", + "start": 21, + "end": 22, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + }, + "identifierName": "f" + }, + "name": "f" + }, + "operator": "||", + "right": { + "type": "Identifier", + "start": 26, + "end": 27, + "loc": { + "start": { + "line": 2, + "column": 11 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "h" + }, + "name": "h" + } + } + }, + "operator": "|>", + "right": { + "type": "Identifier", + "start": 31, + "end": 34, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 19 + }, + "identifierName": "inc" + }, + "name": "inc" + } + } + } + ], + "directives": [] + } +} diff --git a/test/fixtures/experimental/pipeline-operator/precedence/options.json b/test/fixtures/experimental/pipeline-operator/precedence/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/precedence/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +} diff --git a/test/fixtures/experimental/pipeline-operator/with-arrow/actual.js b/test/fixtures/experimental/pipeline-operator/with-arrow/actual.js new file mode 100644 index 0000000000..a8cf1d7f87 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/with-arrow/actual.js @@ -0,0 +1 @@ +10 |> x => x + 1; diff --git a/test/fixtures/experimental/pipeline-operator/with-arrow/expected.json b/test/fixtures/experimental/pipeline-operator/with-arrow/expected.json new file mode 100644 index 0000000000..1a3fed18dc --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/with-arrow/expected.json @@ -0,0 +1,176 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "BinaryExpression", + "start": 0, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "left": { + "type": "NumericLiteral", + "start": 0, + "end": 2, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 2 + } + }, + "extra": { + "rawValue": 10, + "raw": "10" + }, + "value": 10 + }, + "operator": "|>", + "right": { + "type": "ArrowFunctionExpression", + "start": 6, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "id": null, + "generator": false, + "expression": true, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "x" + }, + "name": "x" + } + ], + "body": { + "type": "BinaryExpression", + "start": 11, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "left": { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 15, + "end": 16, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 16 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + } + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/test/fixtures/experimental/pipeline-operator/with-arrow/options.json b/test/fixtures/experimental/pipeline-operator/with-arrow/options.json new file mode 100644 index 0000000000..599d48a469 --- /dev/null +++ b/test/fixtures/experimental/pipeline-operator/with-arrow/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["pipelineOperator"] +}