Debian Codegraph @

packages/babel-plugin-proposal-pipeline-operator/src/smartVisitor.ts

raw symbols SCIP
1 import { types as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/ } from "@babel/core"scip-typescript npm @babel/core 7.20.12 src/`index.ts`/;
2 import type { PluginPassscip-typescript npm @babel/core 7.20.12 src/transformation/`plugin-pass.ts`/PluginPass# } from "@babel/core"scip-typescript npm @babel/core 7.20.12 src/`index.ts`/;
3 import type { Visitorscip-typescript npm @babel/traverse 7.20.13 src/`types.ts`/Visitor# } from "@babel/traverse"scip-typescript npm @babel/traverse 7.20.13 src/`index.ts`/;
4
5 const updateTopicReferenceVisitorscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/updateTopicReferenceVisitor.: Visitorscip-typescript npm @babel/traverse 7.20.13 src/`types.ts`/Visitor#<{ topicIdscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/updateTopicReferenceVisitor.Visitor:typeLiteral2:topicId.: tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Identifierscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Identifier# }> = {
6 PipelinePrimaryTopicReference(path) {
7 path.replaceWithscip-typescript npm @babel/traverse 7.20.13 src/path/`replacement.ts`/replaceWith().(tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.cloneNode(this.topicIdscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/updateTopicReferenceVisitor.Visitor:typeLiteral2:topicId.));
8 },
9 PipelineTopicExpression(path) {
10 path.skipscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/skip().();
11 },
12 };
13
14 const smartVisitorscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/smartVisitor.: Visitorscip-typescript npm @babel/traverse 7.20.13 src/`types.ts`/Visitor#<PluginPassscip-typescript npm @babel/core 7.20.12 src/transformation/`plugin-pass.ts`/PluginPass#> = {
15 BinaryExpression(path) {
16 const { scopescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#scope. } = path;
17 const { nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node. } = path;
18 const { operatorscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/BinaryExpression#operator., leftscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/BinaryExpression#left., rightscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/BinaryExpression#right. } = node;
19 if (operator !== "|>") return;
20
21 const placeholder = scope.generateUidIdentifierBasedOnNodescip-typescript npm @babel/traverse 7.20.13 src/scope/`index.ts`/Scope#generateUidIdentifierBasedOnNode().(left);
22 scope.pushscip-typescript npm @babel/traverse 7.20.13 src/scope/`index.ts`/Scope#push().({ idscip-typescript npm @babel/traverse 7.20.13 src/scope/`index.ts`/Scope#push().(opts)typeLiteral191:id.: placeholder });
23
24 let call;
25 if (tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.isPipelineTopicExpressionscip-typescript npm @babel/types 7.20.7 src/validators/generated/`index.ts`/isPipelineTopicExpression().(right)) {
26 path
27 .get("right")
28 .traversescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#traverse().(updateTopicReferenceVisitorscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/updateTopicReferenceVisitor., { topicIdscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/topicId0:: placeholder });
29
30 call = right.expressionscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/PipelineTopicExpression#expression.;
31 } else {
32 // PipelineBareFunction
33 let callee = (right as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.CallExpressionscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/CallExpression#).calleescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/CallExpression#callee.;
34 if (tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.isIdentifierscip-typescript npm @babel/types 7.20.7 src/validators/generated/`index.ts`/isIdentifier().(callee, { namescip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/name0:: "eval" })) {
35 callee = tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.sequenceExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/sequenceExpression().([tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.numericLiteralscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/numericLiteral().(0), callee]);
36 }
37
38 call = tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.callExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/callExpression().(callee, [tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.cloneNode(placeholder)]);
39 }
40
41 path.replaceWithscip-typescript npm @babel/traverse 7.20.13 src/path/`replacement.ts`/replaceWith().(
42 tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.sequenceExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/sequenceExpression().([
43 tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.assignmentExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/assignmentExpression().(
44 "=",
45 tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.cloneNode(placeholder),
46 // left must not be a PrivateName because operator is not "in"
47 left as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Expressionscip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Expression#,
48 ),
49 call,
50 ]),
51 );
52 },
53 };
54
55 export default smartVisitorscip-typescript npm @babel/plugin-proposal-pipeline-operator 7.18.9 src/`smartVisitor.ts`/smartVisitor.;