From da026137ba3ea06f169558d14a6baf37d05b1e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=C2=A0S=2E=20Choi?= Date: Thu, 8 Apr 2021 22:32:22 -0400 Subject: [PATCH] =?UTF-8?q?Rename=20=E2=80=9Cprimary=20topic=20reference?= =?UTF-8?q?=E2=80=9D=20to=20=E2=80=9Ctopic=20reference=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The “primary” part was a vestige of the old smart-mix pipeline proposal. --- .../babel-generator/src/generators/types.ts | 2 +- .../babel-parser/src/parser/error-message.js | 8 +-- .../babel-parser/src/parser/expression.js | 14 ++-- .../input.js | 0 .../options.json | 0 .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../hack-proposal-async-await/output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 6 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 6 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../hack-proposal-generator-yield/output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 2 +- .../output.json | 6 +- .../output.json | 2 +- .../output.json | 4 +- .../output.json | 2 +- .../output.json | 2 +- .../src/hackVisitor.js | 2 +- .../src/path/generated/asserts.ts | 12 +--- .../src/path/generated/validators.ts | 10 +-- .../src/asserts/generated/index.ts | 24 ++----- .../src/ast-types/generated/index.ts | 23 ++----- .../src/builders/generated/index.ts | 16 +---- .../src/builders/generated/uppercase.js | 4 +- .../src/definitions/experimental.ts | 2 +- .../src/validators/generated/index.ts | 69 +++++-------------- 46 files changed, 89 insertions(+), 175 deletions(-) rename packages/babel-parser/test/fixtures/experimental/pipeline-operator/{fsharp-proposal-invalid-primary-topic => fsharp-proposal-invalid-topic}/input.js (100%) rename packages/babel-parser/test/fixtures/experimental/pipeline-operator/{fsharp-proposal-invalid-primary-topic => fsharp-proposal-invalid-topic}/options.json (100%) rename packages/babel-parser/test/fixtures/experimental/pipeline-operator/{fsharp-proposal-invalid-primary-topic => fsharp-proposal-invalid-topic}/output.json (96%) diff --git a/packages/babel-generator/src/generators/types.ts b/packages/babel-generator/src/generators/types.ts index 30bfa48438d1..0be7d04e5f7c 100644 --- a/packages/babel-generator/src/generators/types.ts +++ b/packages/babel-generator/src/generators/types.ts @@ -236,6 +236,6 @@ export function DecimalLiteral(this: Printer, node: t.DecimalLiteral) { this.word(node.value + "m"); } -export function PipelinePrimaryTopicReference(this: Printer) { +export function TopicReference(this: Printer) { this.token("#"); } diff --git a/packages/babel-parser/src/parser/error-message.js b/packages/babel-parser/src/parser/error-message.js index fae9f62ab76b..134de1c73675 100644 --- a/packages/babel-parser/src/parser/error-message.js +++ b/packages/babel-parser/src/parser/error-message.js @@ -131,12 +131,12 @@ export const ErrorMessages = Object.freeze({ PatternHasMethod: "Object pattern can't contain methods", PipeBodyCannotBeArrow: 'Unexpected arrow "=>" after pipeline body; arrow function acting as pipe body must be parenthesized due to operator precedence', + PipeTopicRequiresHackPipes: + "Topic reference is used, but the pipelineOperator plugin was not passed a 'proposal': 'hack' option.", + PipeTopicUnbound: + "Topic reference is unbound; it must be inside a Hack-style pipe body", PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once", - PrimaryTopicNotAllowed: - "Topic reference is unbound; it must be inside a Hack-style pipe body", - PrimaryTopicRequiresHackPipes: - "Topic reference is used, but the pipelineOperator plugin was not passed a 'proposal': 'hack' option.", PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`)", PrivateNameRedeclaration: "Duplicate private name #%0", diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 5c78a445af1a..fec3c8e34800 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -1150,17 +1150,17 @@ export default class ExpressionParser extends LValParser { node = this.startNode(); if (this.getPluginOption("pipelineOperator", "proposal") !== "hack") { - this.raise(node.start, Errors.PrimaryTopicRequiresHackPipes); + this.raise(node.start, Errors.PipeTopicRequiresHackPipes); } this.next(); - if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) { - this.raise(node.start, Errors.PrimaryTopicNotAllowed); + if (!this.topicReferenceIsAllowedInCurrentContext()) { + this.raise(node.start, Errors.PipeTopicUnbound); } this.registerTopicReference(); - return this.finishNode(node, "PipelinePrimaryTopicReference"); + return this.finishNode(node, "TopicReference"); } // https://tc39.es/proposal-private-fields-in-in @@ -2475,7 +2475,7 @@ export default class ExpressionParser extends LValParser { throw this.raise(this.state.start, Errors.PipeBodyCannotBeArrow); } // A Hack pipe body must use the topic reference at least once. - else if (!this.topicReferenceWasUsedInCurrentTopicContext()) { + else if (!this.topicReferenceWasUsedInCurrentContext()) { this.raise(startPos, Errors.PipeTopicUnused); } } @@ -2547,11 +2547,11 @@ export default class ExpressionParser extends LValParser { this.state.topicContext.maxTopicIndex = 0; } - primaryTopicReferenceIsAllowedInCurrentTopicContext(): boolean { + topicReferenceIsAllowedInCurrentContext(): boolean { return this.state.topicContext.maxNumOfResolvableTopics >= 1; } - topicReferenceWasUsedInCurrentTopicContext(): boolean { + topicReferenceWasUsedInCurrentContext(): boolean { return ( this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0 diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/input.js b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/input.js rename to packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/options.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/options.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/options.json rename to packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/options.json diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/output.json similarity index 96% rename from packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/output.json rename to packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/output.json index 09d380af7eee..776a3fdb32a2 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-primary-topic/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/fsharp-proposal-invalid-topic/output.json @@ -27,7 +27,7 @@ "type": "BinaryExpression", "start":5,"end":10,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":10}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":5,"end":6,"loc":{"start":{"line":1,"column":5},"end":{"line":1,"column":6}} }, "operator": "+", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-first/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-first/output.json index 64f3ac41c7d3..4af6702b93c0 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-first/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-first/output.json @@ -23,7 +23,7 @@ "type": "BinaryExpression", "start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} }, "operator": "+", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-last/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-last/output.json index 57a00fffae99..09d48e0129f5 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-last/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-addition-with-topic-last/output.json @@ -33,7 +33,7 @@ }, "operator": "+", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-arrow-function-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-arrow-function-parenthesized/output.json index 5e139c270b56..3bb77cf7bf46 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-arrow-function-parenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-arrow-function-parenthesized/output.json @@ -34,7 +34,7 @@ "type": "BinaryExpression", "start":16,"end":21,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":21}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} }, "operator": "+", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-async-await/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-async-await/output.json index 1625a86dabd5..ce3d60256e05 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-async-await/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-async-await/output.json @@ -38,7 +38,7 @@ "type": "AwaitExpression", "start":36,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":21}}, "argument": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":42,"end":43,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-do-while-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-do-while-loop-and-topic-in-loop-head/output.json index 9811af7c2958..345171660358 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-do-while-loop-and-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-do-while-loop-and-topic-in-loop-head/output.json @@ -62,7 +62,7 @@ }, "operator": "<", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":36,"end":37,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":37}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-await-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-await-of-loop-and-topic-in-loop-head/output.json index feb7e2af914e..f8348a6ed901 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-await-of-loop-and-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-await-of-loop-and-topic-in-loop-head/output.json @@ -63,7 +63,7 @@ "kind": "const" }, "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":61,"end":62,"loc":{"start":{"line":2,"column":38},"end":{"line":2,"column":39}} }, "body": { diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-classic-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-classic-loop-and-topic-in-loop-head/output.json index c750bfb12d02..497d44a0b858 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-classic-loop-and-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-classic-loop-and-topic-in-loop-head/output.json @@ -42,7 +42,7 @@ "name": "i" }, "init": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}} } } @@ -64,7 +64,7 @@ "name": "i" }, { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":43,"end":44,"loc":{"start":{"line":1,"column":43},"end":{"line":1,"column":44}} } ] @@ -79,7 +79,7 @@ "name": "i" }, "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":52,"end":53,"loc":{"start":{"line":1,"column":52},"end":{"line":1,"column":53}} } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-in-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-in-loop-and-topic-in-loop-head/output.json index 37ca5e6e98c7..60dc22702d08 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-in-loop-and-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-in-loop-and-topic-in-loop-head/output.json @@ -35,7 +35,7 @@ "name": "e" }, "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} }, "body": { diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-of-loop-and-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-of-loop-and-topic-in-loop-head/output.json index 40ee7a2d5232..93bcff9965b4 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-of-loop-and-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-for-of-loop-and-topic-in-loop-head/output.json @@ -36,7 +36,7 @@ "name": "e" }, "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":24,"end":25,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":25}} }, "body": { diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-body/output.json index d3b3120e8cb3..2641d98286c6 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-body/output.json @@ -54,7 +54,7 @@ "type": "ExpressionStatement", "start":42,"end":44,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":44}}, "expression": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":42,"end":43,"loc":{"start":{"line":1,"column":42},"end":{"line":1,"column":43}} } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-if-body/output.json index e2a970c269df..4307debf4417 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-if-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-else-if-body/output.json @@ -46,7 +46,7 @@ "type": "ExpressionStatement", "start":34,"end":36,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":36}}, "expression": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":34,"end":35,"loc":{"start":{"line":1,"column":34},"end":{"line":1,"column":35}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-body/output.json index b87c4a062278..a7bc612c49ac 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-body/output.json @@ -38,7 +38,7 @@ "type": "ExpressionStatement", "start":23,"end":25,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":25}}, "expression": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-head/output.json index 2c168e294138..ed2fdf79db16 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-if-statement-and-topic-in-if-head/output.json @@ -30,7 +30,7 @@ "type": "IfStatement", "start":14,"end":31,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":31}}, "test": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} }, "consequent": { diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-body/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-body/output.json index 7615ce21028c..a8c482a15629 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-body/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-body/output.json @@ -43,7 +43,7 @@ "type": "ExpressionStatement", "start":46,"end":48,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":14}}, "expression": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":46,"end":47,"loc":{"start":{"line":3,"column":12},"end":{"line":3,"column":13}} } } @@ -69,7 +69,7 @@ "type": "BinaryExpression", "start":61,"end":66,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":17}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":61,"end":62,"loc":{"start":{"line":4,"column":12},"end":{"line":4,"column":13}} }, "operator": "+", @@ -106,7 +106,7 @@ "type": "BinaryExpression", "start":81,"end":87,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":19}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":81,"end":82,"loc":{"start":{"line":5,"column":13},"end":{"line":5,"column":14}} }, "operator": "+", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-head/output.json index 39d9ac06f5a2..2ed10d94e2f5 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-switch-statement-and-topic-in-switch-head/output.json @@ -30,7 +30,7 @@ "type": "SwitchStatement", "start":16,"end":81,"loc":{"start":{"line":2,"column":2},"end":{"line":6,"column":3}}, "discriminant": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":24,"end":25,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":11}} }, "cases": [ diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-topic-identity/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-topic-identity/output.json index 9378c0805280..bd562e658bc0 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-topic-identity/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-topic-identity/output.json @@ -30,7 +30,7 @@ "type": "ExpressionStatement", "start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}}, "expression": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":14,"end":15,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":15}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-finally-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-finally-clause/output.json index f68edd871f5b..49b9784a5a2f 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-finally-clause/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-finally-clause/output.json @@ -129,7 +129,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":110,"end":111,"loc":{"start":{"line":4,"column":22},"end":{"line":4,"column":23}} } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-try-clause/output.json index b76987f8530e..bd46d7bd4df1 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-try-clause/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-finally-statements-and-topic-in-try-clause/output.json @@ -56,7 +56,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-statements-topic-in-try-clause/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-statements-topic-in-try-clause/output.json index 37ad676d27bb..f3a4ae5554aa 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-statements-topic-in-try-clause/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-try-catch-statements-topic-in-try-clause/output.json @@ -56,7 +56,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":33,"end":34,"loc":{"start":{"line":2,"column":19},"end":{"line":2,"column":20}} } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-while-loop-topic-in-loop-head/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-while-loop-topic-in-loop-head/output.json index d514f679a4d0..b8da20531f7b 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-while-loop-topic-in-loop-head/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-do-expression-with-while-loop-topic-in-loop-head/output.json @@ -39,7 +39,7 @@ }, "operator": "<", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":25,"end":26,"loc":{"start":{"line":1,"column":25},"end":{"line":1,"column":26}} } }, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-call-with-topic-in-argument/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-call-with-topic-in-argument/output.json index c969383ca6dd..81ae12185c6c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-call-with-topic-in-argument/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-call-with-topic-in-argument/output.json @@ -29,7 +29,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} } ] diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-definition-with-topic-in-default-parameter/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-definition-with-topic-in-default-parameter/output.json index 9417c561297f..3895abf6bf98 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-definition-with-topic-in-default-parameter/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-function-definition-with-topic-in-default-parameter/output.json @@ -35,7 +35,7 @@ "name": "x" }, "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":23,"end":24,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":24}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-generator-yield/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-generator-yield/output.json index 7a68186e4a4c..3ba1c1563043 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-generator-yield/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-generator-yield/output.json @@ -43,7 +43,7 @@ }, "delegate": false, "argument": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":39,"end":40,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":22}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-mixed-pipeline-plugins/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-mixed-pipeline-plugins/output.json index 0d8bc656d92c..26d454dbfd87 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-mixed-pipeline-plugins/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-mixed-pipeline-plugins/output.json @@ -20,7 +20,7 @@ }, "operator": "|>", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json index d20a459431dc..df693ae84d99 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-inner-topic/output.json @@ -43,7 +43,7 @@ "type": "BinaryExpression", "start":11,"end":21,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":21}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} }, "operator": "|>", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json index ae683146d4d5..9606ec01089c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function-without-outer-topic/output.json @@ -49,7 +49,7 @@ }, "operator": "|>", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":16,"end":17,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":17}} } } diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function/output.json index 728e36f350e0..4fcf20826e22 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-with-arrow-function/output.json @@ -43,7 +43,7 @@ "type": "BinaryExpression", "start":11,"end":23,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":23}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":11,"end":12,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}} }, "operator": "|>", @@ -57,7 +57,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":18,"end":19,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":19}} }, { @@ -73,7 +73,7 @@ "type": "BinaryExpression", "start":27,"end":32,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":32}}, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":27,"end":28,"loc":{"start":{"line":1,"column":27},"end":{"line":1,"column":28}} }, "operator": ">", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-without-inner-topic/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-without-inner-topic/output.json index d3515aacff42..bc249061cafc 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-without-inner-topic/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines-without-inner-topic/output.json @@ -30,7 +30,7 @@ "parenStart": 5 }, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, "operator": "|>", diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines/output.json index bedbb4372b44..12c2619c004c 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-nested-pipelines/output.json @@ -27,7 +27,7 @@ "parenStart": 5 }, "left": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":6,"end":7,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":7}} }, "operator": "|>", @@ -41,7 +41,7 @@ }, "arguments": [ { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":13,"end":14,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":14}} }, { diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-parenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-parenthesized/output.json index 0bdbb5a0fafe..90324568fe54 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-parenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-parenthesized/output.json @@ -20,7 +20,7 @@ }, "operator": "|>", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":10,"end":11,"loc":{"start":{"line":1,"column":10},"end":{"line":1,"column":11}}, "extra": { "parenthesized": true, diff --git a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-unparenthesized/output.json b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-unparenthesized/output.json index 0d8bc656d92c..26d454dbfd87 100644 --- a/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-unparenthesized/output.json +++ b/packages/babel-parser/test/fixtures/experimental/pipeline-operator/hack-proposal-topic-identity-unparenthesized/output.json @@ -20,7 +20,7 @@ }, "operator": "|>", "right": { - "type": "PipelinePrimaryTopicReference", + "type": "TopicReference", "start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10}} } } diff --git a/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.js b/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.js index c010f8bfbb71..56a69e9ab131 100644 --- a/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.js +++ b/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.js @@ -5,7 +5,7 @@ function pathNodeIsPipeExpression(path) { } const topicReferenceReplacementVisitor = { - PipelinePrimaryTopicReference(path) { + TopicReference(path) { path.replaceWith(t.cloneNode(this.topicVariable)); }, }; diff --git a/packages/babel-traverse/src/path/generated/asserts.ts b/packages/babel-traverse/src/path/generated/asserts.ts index b0e6e22ccf05..72c5f8a99b93 100755 --- a/packages/babel-traverse/src/path/generated/asserts.ts +++ b/packages/babel-traverse/src/path/generated/asserts.ts @@ -395,15 +395,6 @@ export interface NodePathAssetions { ): asserts this is NodePath; assertPattern(opts?: object): asserts this is NodePath; assertPatternLike(opts?: object): asserts this is NodePath; - assertPipelineBareFunction( - opts?: object, - ): asserts this is NodePath; - assertPipelinePrimaryTopicReference( - opts?: object, - ): asserts this is NodePath; - assertPipelineTopicExpression( - opts?: object, - ): asserts this is NodePath; assertPlaceholder(opts?: object): asserts this is NodePath; assertPrivate(opts?: object): asserts this is NodePath; assertPrivateName(opts?: object): asserts this is NodePath; @@ -630,6 +621,9 @@ export interface NodePathAssetions { assertThrowStatement( opts?: object, ): asserts this is NodePath; + assertTopicReference( + opts?: object, + ): asserts this is NodePath; assertTryStatement(opts?: object): asserts this is NodePath; assertTupleExpression( opts?: object, diff --git a/packages/babel-traverse/src/path/generated/validators.ts b/packages/babel-traverse/src/path/generated/validators.ts index ced5e539075a..cb0ecd9a30b6 100755 --- a/packages/babel-traverse/src/path/generated/validators.ts +++ b/packages/babel-traverse/src/path/generated/validators.ts @@ -241,15 +241,6 @@ export interface NodePathValidators { ): this is NodePath; isPattern(opts?: object): this is NodePath; isPatternLike(opts?: object): this is NodePath; - isPipelineBareFunction( - opts?: object, - ): this is NodePath; - isPipelinePrimaryTopicReference( - opts?: object, - ): this is NodePath; - isPipelineTopicExpression( - opts?: object, - ): this is NodePath; isPlaceholder(opts?: object): this is NodePath; isPrivate(opts?: object): this is NodePath; isPrivateName(opts?: object): this is NodePath; @@ -380,6 +371,7 @@ export interface NodePathValidators { isThisExpression(opts?: object): this is NodePath; isThisTypeAnnotation(opts?: object): this is NodePath; isThrowStatement(opts?: object): this is NodePath; + isTopicReference(opts?: object): this is NodePath; isTryStatement(opts?: object): this is NodePath; isTupleExpression(opts?: object): this is NodePath; isTupleTypeAnnotation(opts?: object): this is NodePath; diff --git a/packages/babel-types/src/asserts/generated/index.ts b/packages/babel-types/src/asserts/generated/index.ts index 04cf3195f184..808fa9db7948 100755 --- a/packages/babel-types/src/asserts/generated/index.ts +++ b/packages/babel-types/src/asserts/generated/index.ts @@ -1004,24 +1004,6 @@ export function assertClassProperty( ): asserts node is t.ClassProperty { assert("ClassProperty", node, opts); } -export function assertPipelineTopicExpression( - node: object | null | undefined, - opts?: object | null, -): asserts node is t.PipelineTopicExpression { - assert("PipelineTopicExpression", node, opts); -} -export function assertPipelineBareFunction( - node: object | null | undefined, - opts?: object | null, -): asserts node is t.PipelineBareFunction { - assert("PipelineBareFunction", node, opts); -} -export function assertPipelinePrimaryTopicReference( - node: object | null | undefined, - opts?: object | null, -): asserts node is t.PipelinePrimaryTopicReference { - assert("PipelinePrimaryTopicReference", node, opts); -} export function assertClassPrivateProperty( node: object | null | undefined, opts?: object | null, @@ -1094,6 +1076,12 @@ export function assertModuleExpression( ): asserts node is t.ModuleExpression { assert("ModuleExpression", node, opts); } +export function assertTopicReference( + node: object | null | undefined, + opts?: object | null, +): asserts node is t.TopicReference { + assert("TopicReference", node, opts); +} export function assertTSParameterProperty( node: object | null | undefined, opts?: object | null, diff --git a/packages/babel-types/src/ast-types/generated/index.ts b/packages/babel-types/src/ast-types/generated/index.ts index df363a9e857d..cd42fe88acd6 100755 --- a/packages/babel-types/src/ast-types/generated/index.ts +++ b/packages/babel-types/src/ast-types/generated/index.ts @@ -211,9 +211,6 @@ export type Node = | ParenthesizedExpression | Pattern | PatternLike - | PipelineBareFunction - | PipelinePrimaryTopicReference - | PipelineTopicExpression | Placeholder | Private | PrivateName @@ -314,6 +311,7 @@ export type Node = | ThisExpression | ThisTypeAnnotation | ThrowStatement + | TopicReference | TryStatement | TupleExpression | TupleTypeAnnotation @@ -1531,20 +1529,6 @@ export interface ClassProperty extends BaseNode { readonly?: boolean | null; } -export interface PipelineTopicExpression extends BaseNode { - type: "PipelineTopicExpression"; - expression: Expression; -} - -export interface PipelineBareFunction extends BaseNode { - type: "PipelineBareFunction"; - callee: Expression; -} - -export interface PipelinePrimaryTopicReference extends BaseNode { - type: "PipelinePrimaryTopicReference"; -} - export interface ClassPrivateProperty extends BaseNode { type: "ClassPrivateProperty"; key: PrivateName; @@ -1628,6 +1612,10 @@ export interface ModuleExpression extends BaseNode { body: Program; } +export interface TopicReference extends BaseNode { + type: "TopicReference"; +} + export interface TSParameterProperty extends BaseNode { type: "TSParameterProperty"; parameter: Identifier | AssignmentPattern; @@ -2048,7 +2036,6 @@ export type Expression = | JSXElement | JSXFragment | BindExpression - | PipelinePrimaryTopicReference | DoExpression | RecordExpression | TupleExpression diff --git a/packages/babel-types/src/builders/generated/index.ts b/packages/babel-types/src/builders/generated/index.ts index 2ade18539370..eb2292bb01f7 100755 --- a/packages/babel-types/src/builders/generated/index.ts +++ b/packages/babel-types/src/builders/generated/index.ts @@ -998,19 +998,6 @@ export function classProperty( ): t.ClassProperty { return builder("ClassProperty", ...arguments); } -export function pipelineTopicExpression( - expression: t.Expression, -): t.PipelineTopicExpression { - return builder("PipelineTopicExpression", ...arguments); -} -export function pipelineBareFunction( - callee: t.Expression, -): t.PipelineBareFunction { - return builder("PipelineBareFunction", ...arguments); -} -export function pipelinePrimaryTopicReference(): t.PipelinePrimaryTopicReference { - return builder("PipelinePrimaryTopicReference", ...arguments); -} export function classPrivateProperty( key: t.PrivateName, value: t.Expression | null | undefined, @@ -1069,6 +1056,9 @@ export function staticBlock(body: Array): t.StaticBlock { export function moduleExpression(body: t.Program): t.ModuleExpression { return builder("ModuleExpression", ...arguments); } +export function topicReference(): t.TopicReference { + return builder("TopicReference", ...arguments); +} export function tsParameterProperty( parameter: t.Identifier | t.AssignmentPattern, ): t.TSParameterProperty { diff --git a/packages/babel-types/src/builders/generated/uppercase.js b/packages/babel-types/src/builders/generated/uppercase.js index 3e25736a38d1..0c1297b0f31c 100755 --- a/packages/babel-types/src/builders/generated/uppercase.js +++ b/packages/babel-types/src/builders/generated/uppercase.js @@ -174,9 +174,6 @@ export { argumentPlaceholder as ArgumentPlaceholder, bindExpression as BindExpression, classProperty as ClassProperty, - pipelineTopicExpression as PipelineTopicExpression, - pipelineBareFunction as PipelineBareFunction, - pipelinePrimaryTopicReference as PipelinePrimaryTopicReference, classPrivateProperty as ClassPrivateProperty, classPrivateMethod as ClassPrivateMethod, importAttribute as ImportAttribute, @@ -189,6 +186,7 @@ export { decimalLiteral as DecimalLiteral, staticBlock as StaticBlock, moduleExpression as ModuleExpression, + topicReference as TopicReference, tsParameterProperty as TSParameterProperty, tsDeclareFunction as TSDeclareFunction, tsDeclareMethod as TSDeclareMethod, diff --git a/packages/babel-types/src/definitions/experimental.ts b/packages/babel-types/src/definitions/experimental.ts index 7430eeb67642..f605aad139f5 100644 --- a/packages/babel-types/src/definitions/experimental.ts +++ b/packages/babel-types/src/definitions/experimental.ts @@ -256,4 +256,4 @@ defineType("ModuleExpression", { // https://github.com/tc39/proposal-pipeline-operator // https://github.com/js-choi/proposal-hack-pipes -defineType("PipelinePrimaryTopicReference", {}); +defineType("TopicReference", {}); diff --git a/packages/babel-types/src/validators/generated/index.ts b/packages/babel-types/src/validators/generated/index.ts index d24f3f81bfbf..8179a94f1704 100755 --- a/packages/babel-types/src/validators/generated/index.ts +++ b/packages/babel-types/src/validators/generated/index.ts @@ -2810,57 +2810,6 @@ export function isClassProperty( return false; } -export function isPipelineTopicExpression( - node: object | null | undefined, - opts?: object | null, -): node is t.PipelineTopicExpression { - if (!node) return false; - - const nodeType = (node as t.Node).type; - if (nodeType === "PipelineTopicExpression") { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; -} -export function isPipelineBareFunction( - node: object | null | undefined, - opts?: object | null, -): node is t.PipelineBareFunction { - if (!node) return false; - - const nodeType = (node as t.Node).type; - if (nodeType === "PipelineBareFunction") { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; -} -export function isPipelinePrimaryTopicReference( - node: object | null | undefined, - opts?: object | null, -): node is t.PipelinePrimaryTopicReference { - if (!node) return false; - - const nodeType = (node as t.Node).type; - if (nodeType === "PipelinePrimaryTopicReference") { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; -} export function isClassPrivateProperty( node: object | null | undefined, opts?: object | null, @@ -3065,6 +3014,23 @@ export function isModuleExpression( return false; } +export function isTopicReference( + node: object | null | undefined, + opts?: object | null, +): node is t.TopicReference { + if (!node) return false; + + const nodeType = (node as t.Node).type; + if (nodeType === "TopicReference") { + if (typeof opts === "undefined") { + return true; + } else { + return shallowEqual(node, opts); + } + } + + return false; +} export function isTSParameterProperty( node: object | null | undefined, opts?: object | null, @@ -4181,7 +4147,6 @@ export function isExpression( "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || - "PipelinePrimaryTopicReference" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType ||