Debian Codegraph @

packages/babel-traverse/src/path/family.ts

raw symbols SCIP
1 // This file contains methods responsible for dealing with/retrieving children or siblings.
2
3 import type TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext# from "../context"scip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/;
4 import NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# from "./index"scip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/;
5 import {
6 getBindingIdentifiers as _getBindingIdentifiersscip-typescript npm @babel/types 7.20.7 src/retrievers/`getBindingIdentifiers.ts`/getBindingIdentifiers().,
7 getOuterBindingIdentifiers as _getOuterBindingIdentifiers,
8 isDeclarationscip-typescript npm @babel/types 7.20.7 src/validators/generated/`index.ts`/isDeclaration().,
9 numericLiteralscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/numericLiteral().,
10 unaryExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/unaryExpression().,
11 } from "@babel/types"scip-typescript npm @babel/types 7.20.7 src/`index.ts`/;
12 import type * as tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/ from "@babel/types"scip-typescript npm @babel/types 7.20.7 src/`index.ts`/;
13
14 const NORMAL_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NORMAL_COMPLETION. = 0 as const;
15 const BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION. = 1 as const;
16
17 type Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion# = {
18 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path.: NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#;
19 typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type.: 0 | 1;
20 };
21
22 type CompletionContextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext# = {
23 // whether the current context allows `break` statement. When it allows, we have
24 // to search all the statements for potential `break`
25 canHaveBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:canHaveBreak.: boolean;
26 // whether the statement is an immediate descendant of a switch case clause
27 inCaseClausescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:inCaseClause.: boolean;
28 // whether the `break` statement record should be populated to upper level
29 // when a `break` statement is an immediate descendant of a block statement, e.g.
30 // `{ break }`, it can influence the control flow in the upper levels.
31 shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak.: boolean;
32 };
33
34 function NormalCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NormalCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NormalCompletion().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#) {
35 return { typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/type0:: NORMAL_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NORMAL_COMPLETION., pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/path0: };
36 }
37
38 function BreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BreakCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BreakCompletion().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#) {
39 return { typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/type1:: BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION., pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/path1: };
40 }
41
42 export function getOppositescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOpposite().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOpposite().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | null {
43 if (this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key. === "left") {
44 return this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().("right");
45 } else if (this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key. === "right") {
46 return this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().("left");
47 }
48 return null;
49 }
50
51 function addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(
52 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | null | undefined,
53 recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(records): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[],
54 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(context): CompletionContextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#,
55 ): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] {
56 if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(path)) {
57 recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(records).pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(..._getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(path), contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(context)));
58 }
59 return recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(records);
60 }
61
62 function completionRecordForSwitchscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(
63 casesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(cases): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.SwitchCasescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/SwitchCase#>[],
64 recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(records): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[],
65 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(context): CompletionContextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#,
66 ): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] {
67 // https://tc39.es/ecma262/#sec-runtime-semantics-caseblockevaluation
68 let lastNormalCompletions: Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] = [];
69 for (let i = 0; i < casesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(cases).lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.; i++) {
70 const casePath = casesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(cases)[i];
71 const caseCompletions = _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(casePath, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(context));
72 const normalCompletions = [];
73 const breakCompletions = [];
74 for (const c of caseCompletions) {
75 if (c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. === NORMAL_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NORMAL_COMPLETION.) {
76 normalCompletions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(c);
77 }
78 if (c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. === BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION.) {
79 breakCompletions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(c);
80 }
81 }
82 if (normalCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.) {
83 lastNormalCompletions = normalCompletions;
84 }
85 recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(records).pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...breakCompletions);
86 }
87 recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(records).pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...lastNormalCompletions);
88 return recordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(records);
89 }
90
91 function normalCompletionToBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/normalCompletionToBreak().(completionsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/normalCompletionToBreak().(completions): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[]) {
92 completionsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/normalCompletionToBreak().(completions).forEachscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#forEach().(c => {
93 c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. = BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION.;
94 });
95 }
96
97 /**
98 * Determine how we should handle the break statement for break completions
99 *
100 * @param {Completion[]} completions
101 * @param {boolean} reachable Whether the break statement is reachable after
102 we mark the normal completions _before_ the given break completions as the final
103 completions. For example,
104 `{ 0 }; break;` is transformed to `{ return 0 }; break;`, the `break` here is unreachable
105 and thus can be removed without consequences. We may in the future reserve them instead since
106 we do not consistently remove unreachable statements _after_ break
107 `{ var x = 0 }; break;` is transformed to `{ var x = 0 }; return void 0;`, the `break` is reachable
108 because we can not wrap variable declaration under a return statement
109 */
110 function replaceBreakStatementInBreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(
111 completionsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(completions): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[],
112 reachablescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(reachable): boolean,
113 ) {
114 completionsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(completions).forEachscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#forEach().(c => {
115 if (c.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..isBreakStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isBreakStatement().({ labelscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/label0:: null })) {
116 if (reachablescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(reachable)) {
117 c.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..replaceWithscip-typescript npm @babel/traverse 7.20.13 src/path/`replacement.ts`/replaceWith().(unaryExpressionscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/unaryExpression().("void", numericLiteralscip-typescript npm @babel/types 7.20.7 src/builders/generated/`index.ts`/numericLiteral().(0)));
118 } else {
119 c.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..removescip-typescript npm @babel/traverse 7.20.13 src/path/`removal.ts`/remove().();
120 }
121 }
122 });
123 }
124
125 function getStatementListCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(
126 pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[],
127 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context): CompletionContextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#,
128 ): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] {
129 const completions = [];
130 if (contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context).canHaveBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:canHaveBreak.) {
131 let lastNormalCompletions = [];
132 for (let i = 0; i < pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths).lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.; i++) {
133 const path = pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths)[i];
134 const newContext = { ...contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context), inCaseClausescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/inCaseClause0:: false };
135 if (
136 path.isBlockStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isBlockStatement().() &&
137 (contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context).inCaseClausescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:inCaseClause. || // case test: { break }
138 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context).shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak.) // case test: { { break } }
139 ) {
140 newContext.shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak. = true;
141 } else {
142 newContext.shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak. = false;
143 }
144 const statementCompletions = _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path, newContext);
145 if (
146 statementCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. > 0 &&
147 // we can stop search `paths` when we have seen a `path` that is
148 // effectively a `break` statement. Examples are
149 // - `break`
150 // - `if (true) { 1; break } else { 2; break }`
151 // - `{ break }```
152 // In other words, the paths after this `path` are unreachable
153 statementCompletions.everyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#every().(c => c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. === BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION.)
154 ) {
155 if (
156 lastNormalCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. > 0 &&
157 statementCompletions.everyscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#every().(c =>
158 c.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..isBreakStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isBreakStatement().({ labelscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/label1:: null }),
159 )
160 ) {
161 // when a break completion has a path as BreakStatement, it must be `{ break }`
162 // whose completion value we can not determine, otherwise it would have been
163 // replaced by `replaceBreakStatementInBreakCompletion`
164 // When we have seen normal completions from the last statement
165 // it is safe to stop populating break and mark normal completions as break
166 normalCompletionToBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/normalCompletionToBreak().(lastNormalCompletions);
167 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...lastNormalCompletions);
168 // Declarations have empty completion record, however they can not be nested
169 // directly in return statement, i.e. `return (var a = 1)` is invalid.
170 if (lastNormalCompletions.somescip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#some().(c => c.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..isDeclarationscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isDeclaration().())) {
171 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...statementCompletions);
172 replaceBreakStatementInBreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(
173 statementCompletions,
174 /* reachable */ true,
175 );
176 }
177 replaceBreakStatementInBreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(
178 statementCompletions,
179 /* reachable */ false,
180 );
181 } else {
182 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...statementCompletions);
183 if (!contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context).shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak.) {
184 replaceBreakStatementInBreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/replaceBreakStatementInBreakCompletion().(
185 statementCompletions,
186 /* reachable */ true,
187 );
188 }
189 }
190 break;
191 }
192 if (i === pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths).lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. - 1) {
193 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...statementCompletions);
194 } else {
195 lastNormalCompletions = [];
196 for (let i = 0; i < statementCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.; i++) {
197 const c = statementCompletions[i];
198 if (c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. === BREAK_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BREAK_COMPLETION.) {
199 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(c);
200 }
201 if (c.typescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:type. === NORMAL_COMPLETIONscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NORMAL_COMPLETION.) {
202 lastNormalCompletions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(c);
203 }
204 }
205 }
206 }
207 } else if (pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths).lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.) {
208 // When we are in a context where `break` must not exist, we can skip linear
209 // search on statement lists and assume that the last
210 // non-variable-declaration statement determines the completion.
211 for (let i = pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths).lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. - 1; i >= 0; i--) {
212 const pathCompletions = _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(pathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(paths)[i], contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(context));
213 if (
214 pathCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. > 1 ||
215 (pathCompletions.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. === 1 &&
216 !pathCompletions[0].pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path..isVariableDeclarationscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isVariableDeclaration().())
217 ) {
218 completions.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...pathCompletions);
219 break;
220 }
221 }
222 }
223 return completions;
224 }
225
226 function _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(
227 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
228 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context): CompletionContextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#,
229 ): Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] {
230 let records: Completionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#[] = [];
231 if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isIfStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isIfStatement().()) {
232 records = addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("consequent"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
233 records = addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("alternate"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
234 } else if (
235 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isDoExpressionscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isDoExpression().() ||
236 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isForscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isFor().() ||
237 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isWhilescip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isWhile().() ||
238 pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isLabeledStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isLabeledStatement().()
239 ) {
240 // @ts-expect-error(flow->ts): todo
241 return addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("body"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
242 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isProgramscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isProgram().() || pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isBlockStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isBlockStatement().()) {
243 // @ts-expect-error(flow->ts): todo
244 return getStatementListCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("body"), contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
245 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isFunctionscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isFunction().()) {
246 return _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("body"), contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
247 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isTryStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isTryStatement().()) {
248 records = addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("block"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
249 records = addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("handler"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
250 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isCatchClausescip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isCatchClause().()) {
251 return addCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/addCompletionRecords().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("body"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
252 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isSwitchStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isSwitchStatement().()) {
253 return completionRecordForSwitchscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/completionRecordForSwitch().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("cases"), records, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(context));
254 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isSwitchCasescip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isSwitchCase().()) {
255 return getStatementListCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getStatementListCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).get("consequent"), {
256 canHaveBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:canHaveBreak.: true,
257 shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak.: false,
258 inCaseClausescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:inCaseClause.: true,
259 });
260 } else if (pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path).isBreakStatementscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isBreakStatement().()) {
261 records.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(BreakCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/BreakCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path)));
262 } else {
263 records.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(NormalCompletionscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NormalCompletion().(pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(path)));
264 }
265
266 return records;
267 }
268
269 /**
270 * Retrieve the completion records of a given path.
271 * Note: to ensure proper support on `break` statement, this method
272 * will manipulate the AST around the break statement. Do not call the method
273 * twice for the same path.
274 *
275 * @export
276 * @param {NodePath} this
277 * @returns {NodePath[]} Completion records
278 */
279 export function getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getCompletionRecords().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getCompletionRecords().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
280 const records = _getCompletionRecordsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getCompletionRecords().(this, {
281 canHaveBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:canHaveBreak.: false,
282 shouldPopulateBreakscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:shouldPopulateBreak.: false,
283 inCaseClausescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/CompletionContext#typeLiteral12:inCaseClause.: false,
284 });
285 return records.mapscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#map().(r => r.pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Completion#typeLiteral11:path.);
286 }
287
288 export function getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#, keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(key): string | number): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# {
289 return NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#.getscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().({
290 parentPathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parentPath.: this.parentPathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#parentPath.,
291 parentscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parent.: this.parentscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#parent.,
292 containerscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:container.: this.containerscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#container.,
293 listKeyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:listKey.: this.listKeyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#listKey.,
294 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:key.: keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(key),
295 }).setContextscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/setContext().(this.contextscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#context.);
296 }
297
298 export function getPrevSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getPrevSibling().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getPrevSibling().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# {
299 // @ts-expect-error todo(flow->ts) this.key could be a string
300 return this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key. - 1);
301 }
302
303 export function getNextSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getNextSibling().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getNextSibling().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# {
304 // @ts-expect-error todo(flow->ts) this.key could be a string
305 return this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key. + 1);
306 }
307
308 export function getAllNextSiblingsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getAllNextSiblings().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getAllNextSiblings().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
309 // @ts-expect-error todo(flow->ts) this.key could be a string
310 let _key: number = this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key.;
311 let sibling = this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(++_key);
312 const siblings = [];
313 while (sibling.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node.) {
314 siblings.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(sibling);
315 sibling = this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(++_key);
316 }
317 return siblings;
318 }
319
320 export function getAllPrevSiblingsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getAllPrevSiblings().(thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getAllPrevSiblings().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
321 // @ts-expect-error todo(flow->ts) this.key could be a string
322 let _key: number = this.keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#key.;
323 let sibling = this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(--_key);
324 const siblings = [];
325 while (sibling.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node.) {
326 siblings.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(sibling);
327 sibling = this.getSiblingscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getSibling().(--_key);
328 }
329 return siblings;
330 }
331
332 // convert "1" to 1 (string index to number index)
333 type MaybeToIndexscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#[T] extends string> = Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#[T] extends `${bigint}` ? number : Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#[T];
334
335 type Patternscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#<Objscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#[Obj] extends string, Propscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#[Prop] extends string> = `${Objscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#[Obj]}.${Propscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#[Prop]}`;
336
337 // split "body.body.1" to ["body", "body", 1]
338 type Splitscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#<Pscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#[P] extends string> = Pscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#[P] extends Patternscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Pattern#<infer O, infer U>
339 ? [MaybeToIndexscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#<O>, ...Splitscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#<U>]
340 : [MaybeToIndexscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/MaybeToIndex#<Pscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#[P]>];
341
342 // get all K with Node[K] is t.Node | t.Node[]
343 type NodeKeyOfscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#<Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#[Node] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#[]> = keyof Pickscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Pick#<
344 Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#[Node],
345 {
346 [Key in keyof Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#[Node]]-?: Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#[Node][Key] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#[] ? Key : never;
347 }[keyof Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#[Node]]
348 >;
349
350 // traverse the Node with tuple path ["body", "body", 1]
351 // Path should be created with Split
352 type Travscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#<
353 Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Node] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#[],
354 Pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Path] extends unknown[],
355 > = Pathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Path] extends [infer K, ...infer R]
356 ? K extends NodeKeyOfscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/NodeKeyOf#<Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Node]>
357 ? R extends []
358 ? Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Node][K]
359 : // @ts-expect-error ignore since TS is not smart enough
360 Travscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#<Nodescip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#[Node][K], R>
361 : never
362 : never;
363
364 type ToNodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#[T]> = Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#[T] extends Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | null | undefined>
365 ? Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#<NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#[T][number]>>
366 : Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | null | undefined
367 ? NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#[T]>
368 : never;
369
370 function getscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#, Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K] extends keyof Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T]>(
371 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T]>,
372 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key): Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K],
373 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context)?: boolean | TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#,
374 ): Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T][Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K]] extends Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#<tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | null | undefined>
375 ? Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#<NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T][Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K]][number]>>
376 : Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T][Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K]] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node# | null | undefined
377 ? NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T][Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K]]>
378 : never;
379
380 function getscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#, Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K] extends string>(
381 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T]>,
382 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key): Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K],
383 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context)?: boolean | TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#,
384 ): ToNodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/ToNodePath#<Travscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Trav#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T], Splitscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/Split#<Kscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[K]>>>;
385
386 function getscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#>(
387 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T]>,
388 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key): string,
389 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context)?: true | TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#,
390 ): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[];
391
392 function getscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#>(
393 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().[T]>,
394 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key): string,
395 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context): true | TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext# = true,
396 ): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
397 if (contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context) === true) contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context) = this.contextscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#context.;
398 const parts = keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key).splitscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/String#split().(".");
399 if (parts.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length. === 1) {
400 // "foo"
401 // @ts-expect-error key may not index T
402 return this._getKeyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(key), contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context));
403 } else {
404 // "foo.bar"
405 return this._getPatternscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(parts, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get().(context));
406 }
407 }
408
409 export { getscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/get(). };
410
411 export function _getKeyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().[T] extends tscip-typescript npm @babel/types 7.20.7 src/`index.ts`/.Nodescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Node#>(
412 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().[T]>,
413 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(key): keyof Tscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().[T] & string,
414 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(context)?: TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#,
415 ): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
416 const node = this.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node.;
417 const container = node[keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(key)];
418
419 if (Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#.isArrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ArrayConstructor#isArray().(container)) {
420 // requested a container so give them all the paths
421 return container.mapscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#map().((_, i) => {
422 return NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#.getscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().({
423 listKeyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:listKey.: keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(key),
424 parentPathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parentPath.: this,
425 parentscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parent.: node,
426 containerscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:container.: container,
427 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:key.: i,
428 }).setContextscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/setContext().(contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(context));
429 });
430 } else {
431 return NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#.getscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().({
432 parentPathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parentPath.: this,
433 parentscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:parent.: node,
434 containerscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:container.: node,
435 keyscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#get().(`{ hub, parentPath, parent, container, listKey, key, }`)typeLiteral9:key.: keyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(key),
436 }).setContextscip-typescript npm @babel/traverse 7.20.13 src/path/`context.ts`/setContext().(contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getKey().(context));
437 }
438 }
439
440 export function _getPatternscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(
441 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
442 partsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(parts): string[],
443 contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(context)?: TraversalContextscip-typescript npm @babel/traverse 7.20.13 src/`context.ts`/TraversalContext#,
444 ): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] {
445 let path: NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath# | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#[] = this;
446 for (const part of partsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(parts)) {
447 if (part === ".") {
448 // @ts-expect-error todo(flow-ts): Can path be an array here?
449 path = path.parentPathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#parentPath.;
450 } else {
451 if (Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#.isArrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ArrayConstructor#isArray().(path)) {
452 // @ts-expect-error part may not index path
453 path = path[part];
454 } else {
455 path = path.get(part, contextscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/_getPattern().(context));
456 }
457 }
458 }
459 return path;
460 }
461
462 function getBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(
463 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(duplicates): true,
464 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[]>;
465 function getBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(
466 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(duplicates)?: false,
467 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#>;
468 function getBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(
469 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(duplicates): boolean,
470 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[] | 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#>;
471
472 function getBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(
473 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
474 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(duplicates)?: boolean,
475 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[] | 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#> {
476 return _getBindingIdentifiersscip-typescript npm @babel/types 7.20.7 src/retrievers/`getBindingIdentifiers.ts`/getBindingIdentifiers().(this.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node., duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers().(duplicates));
477 }
478
479 export { getBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifiers(). };
480
481 function getOuterBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(
482 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(duplicates): true,
483 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[]>;
484 function getOuterBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(
485 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(duplicates)?: false,
486 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#>;
487 function getOuterBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(
488 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(duplicates): boolean,
489 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[] | 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#>;
490
491 function getOuterBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(
492 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
493 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(duplicates)?: boolean,
494 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, 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#[] | 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#> {
495 return _getOuterBindingIdentifiers(this.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node., duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers().(duplicates));
496 }
497
498 export { getOuterBindingIdentifiersscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifiers(). };
499
500 function getBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(
501 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(duplicates): true,
502 outerOnlyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(outerOnly)?: boolean,
503 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>[]>;
504 function getBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(
505 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(duplicates): false,
506 outerOnlyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(outerOnly)?: boolean,
507 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>>;
508 function getBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(
509 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(duplicates)?: boolean,
510 outerOnlyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(outerOnly)?: boolean,
511 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#> | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>[]>;
512
513 // original source - https://github.com/babel/babel/blob/main/packages/babel-types/src/retrievers/getBindingIdentifiers.js
514 // path.getBindingIdentifiers returns nodes where the following re-implementation returns paths
515 function getBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(
516 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
517 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(duplicates): boolean = false,
518 outerOnlyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(outerOnly): boolean = false,
519 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#> | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>[]> {
520 const path = this;
521 const search = [path];
522 const ids = Objectscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Object#.createscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ObjectConstructor#create().(null);
523
524 while (search.lengthscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#length.) {
525 const id = search.shiftscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#shift().();
526 if (!id) continue;
527 if (!id.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node.) continue;
528
529 const keys =
530 // @ts-expect-error _getBindingIdentifiers.keys do not cover all node types
531 _getBindingIdentifiersscip-typescript npm @babel/types 7.20.7 src/retrievers/`getBindingIdentifiers.ts`/getBindingIdentifiers()..keys[id.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..typescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/ArrayExpression#type.];
532
533 if (id.isIdentifierscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isIdentifier().()) {
534 if (duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(duplicates)) {
535 const _ids = (ids[id.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..namescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Identifier#name.] = ids[id.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..namescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Identifier#name.] || []);
536 _ids.push(id);
537 } else {
538 ids[id.nodescip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#node..namescip-typescript npm @babel/types 7.20.7 src/ast-types/generated/`index.ts`/Identifier#name.] = id;
539 }
540 continue;
541 }
542
543 if (id.isExportDeclarationscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isExportDeclaration().()) {
544 const declaration = id.get("declaration");
545 if (isDeclarationscip-typescript npm @babel/types 7.20.7 src/validators/generated/`index.ts`/isDeclaration().(declaration)) {
546 search.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(declaration);
547 }
548 continue;
549 }
550
551 if (outerOnlyscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths().(outerOnly)) {
552 if (id.isFunctionDeclarationscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isFunctionDeclaration().()) {
553 search.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(id.get("id"));
554 continue;
555 }
556 if (id.isFunctionExpressionscip-typescript npm @babel/traverse 7.20.13 src/path/generated/`validators.d.ts`/BaseNodePathValidators#isFunctionExpression().()) {
557 continue;
558 }
559 }
560
561 if (keys) {
562 for (let i = 0; i < keys.length; i++) {
563 const key = keys[i];
564 const child = id.get(key);
565 if (Arrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#.isArrayscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/ArrayConstructor#isArray().(child)) {
566 search.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(...child);
567 } else if (child.node) {
568 search.pushscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Array#push().(child);
569 }
570 }
571 }
572 }
573
574 return ids;
575 }
576
577 export { getBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getBindingIdentifierPaths(). };
578
579 function getOuterBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(
580 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(duplicates): true,
581 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>[]>;
582 function getOuterBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(
583 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(duplicates)?: false,
584 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>>;
585 function getOuterBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(
586 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(duplicates)?: boolean,
587 ): Recordscip-typescript npm typescript 5.9.3 lib/`lib.es5.d.ts`/Record#<string, NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#> | NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#<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#>[]>;
588
589 function getOuterBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(
590 thisscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(this): NodePathscip-typescript npm @babel/traverse 7.20.13 src/path/`index.ts`/NodePath#,
591 duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(duplicates): boolean = false,
592 ) {
593 return this.getBindingIdentifierPaths(duplicatesscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths().(duplicates), true);
594 }
595
596 export { getOuterBindingIdentifierPathsscip-typescript npm @babel/traverse 7.20.13 src/path/`family.ts`/getOuterBindingIdentifierPaths(). };