Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Caret topic (pipe operator) (#13749)
* parser: Add caret as topic reference (tests) * parser: Add caret as topic reference (implement) * generator: Avoid reconstructing validTopicTokenSet * babel-parser: Remove redundant throws in expression.js * Minimize diff * Update error message Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
ddc45a5
commit ad59a2c
Showing
402 changed files
with
7,202 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/babel-generator/test/fixtures/types/TopicReference-with-caret-topicToken/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 + 3 |> ^.toString(16); |
4 changes: 4 additions & 0 deletions
4
...ges/babel-generator/test/fixtures/types/TopicReference-with-caret-topicToken/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^" }]], | ||
"topicToken": "^" | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-generator/test/fixtures/types/TopicReference-with-caret-topicToken/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 + 3 |> ^.toString(16); |
2 changes: 1 addition & 1 deletion
2
...s/babel-generator/test/fixtures/types/TopicReference-with-invalid-topicToken/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]], | ||
"topicToken": "invalid", | ||
"throws": "The \"topicToken\" generator option must be \"#\" (\"invalid\" received instead)." | ||
"throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (\"invalid\" received instead)." | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/babel-generator/test/fixtures/types/TopicReference-with-missing-topicToken/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]], | ||
"throws": "The \"topicToken\" generator option must be \"#\" (undefined received instead)." | ||
"throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (undefined received instead)." | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-generator/test/fixtures/types/TopicReference-with-percent-topicToken/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 + 3 |> %.toString(16); |
4 changes: 4 additions & 0 deletions
4
...s/babel-generator/test/fixtures/types/TopicReference-with-percent-topicToken/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "%" }]], | ||
"topicToken": "%" | ||
} |
1 change: 1 addition & 0 deletions
1
...ages/babel-generator/test/fixtures/types/TopicReference-with-percent-topicToken/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2 + 3 |> %.toString(16); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...res/experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-first/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
value |> ^ + 1 |
3 changes: 3 additions & 0 deletions
3
...experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-first/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^" }]] | ||
} |
45 changes: 45 additions & 0 deletions
45
.../experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-first/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"expression": { | ||
"type": "BinaryExpression", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"left": { | ||
"type": "Identifier", | ||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, | ||
"name": "value" | ||
}, | ||
"operator": "|>", | ||
"right": { | ||
"type": "BinaryExpression", | ||
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, | ||
"left": { | ||
"type": "TopicReference", | ||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} | ||
}, | ||
"operator": "+", | ||
"right": { | ||
"type": "NumericLiteral", | ||
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}}, | ||
"extra": { | ||
"rawValue": 1, | ||
"raw": "1" | ||
}, | ||
"value": 1 | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...ures/experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-last/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
value |> 1 + ^ |
3 changes: 3 additions & 0 deletions
3
.../experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-last/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^" }]] | ||
} |
45 changes: 45 additions & 0 deletions
45
...s/experimental/pipeline-operator/hack-caret-proposal-addition-with-topic-last/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"expression": { | ||
"type": "BinaryExpression", | ||
"start":0,"end":14,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":14}}, | ||
"left": { | ||
"type": "Identifier", | ||
"start":0,"end":5,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":5},"identifierName":"value"}, | ||
"name": "value" | ||
}, | ||
"operator": "|>", | ||
"right": { | ||
"type": "BinaryExpression", | ||
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, | ||
"left": { | ||
"type": "NumericLiteral", | ||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}}, | ||
"extra": { | ||
"rawValue": 1, | ||
"raw": "1" | ||
}, | ||
"value": 1 | ||
}, | ||
"operator": "+", | ||
"right": { | ||
"type": "TopicReference", | ||
"start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...xtures/experimental/pipeline-operator/hack-caret-proposal-addition-without-topic/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
value |> a + b |
3 changes: 3 additions & 0 deletions
3
...es/experimental/pipeline-operator/hack-caret-proposal-addition-without-topic/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "^" }]] | ||
} |
Oops, something went wrong.