@cplieger/deadset-ts 8.0.0-dev.16 → 8.0.0-dev.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/alias-chain.js +0 -5
- package/dist/src/amd.js +81 -0
- package/dist/src/analysis.js +82 -91
- package/dist/src/augmentations.js +24 -25
- package/dist/src/bindings.js +382 -0
- package/dist/src/calls.js +279 -43
- package/dist/src/commands/tools.js +5 -9
- package/dist/src/component-files.js +3 -2
- package/dist/src/conformance-record.js +1 -1
- package/dist/src/consumers.js +6 -9
- package/dist/src/contextual-uses.js +1 -17
- package/dist/src/contract/config.generated.js +4 -1
- package/dist/src/contract/contract.generated.js +2 -2
- package/dist/src/contract/report.generated.js +6 -2
- package/dist/src/dependencies.js +25 -29
- package/dist/src/destructuring.js +1 -19
- package/dist/src/element-access.js +179 -164
- package/dist/src/entries/build-scripts.js +2 -2
- package/dist/src/entries/configuration-files.js +3 -7
- package/dist/src/entries/conventions.js +2 -2
- package/dist/src/entries/html-entries.js +7 -10
- package/dist/src/entries/mdx-entries.js +2 -2
- package/dist/src/entries/static-module.js +2 -1
- package/dist/src/exempt.js +0 -26
- package/dist/src/exposure.js +400 -0
- package/dist/src/facts.js +4 -4
- package/dist/src/findings/completion.js +44 -21
- package/dist/src/findings/emitters.js +22 -33
- package/dist/src/{implementations.js → findings/implementations.js} +3 -3
- package/dist/src/{in-operands.js → findings/in-operands.js} +2 -2
- package/dist/src/findings/intra-function.js +3 -3
- package/dist/src/findings/reads-and-writes.js +71 -15
- package/dist/src/findings/unused-declarations.js +2 -22
- package/dist/src/findings/visibility-narrowing.js +14 -20
- package/dist/src/framework-lifecycle.js +41 -14
- package/dist/src/import-bindings.js +73 -28
- package/dist/src/index/sites.js +557 -0
- package/dist/src/indexed-access.js +523 -478
- package/dist/src/interface-satisfaction.js +1 -1
- package/dist/src/inventory.js +18 -0
- package/dist/src/keyof-comparisons.js +124 -103
- package/dist/src/{components.js → liveness/components.js} +1 -1
- package/dist/src/{graph.js → liveness/graph.js} +45 -20
- package/dist/src/liveness/matrix.js +99 -0
- package/dist/src/liveness/sweep.js +558 -0
- package/dist/src/load/expected-module.js +2 -2
- package/dist/src/load/specifiers.js +2 -4
- package/dist/src/load/synthesize.js +5 -0
- package/dist/src/load/workspace-resolution.js +2 -2
- package/dist/src/module-declarations.js +70 -85
- package/dist/src/overrides.js +134 -112
- package/dist/src/paths.js +46 -7
- package/dist/src/platform-calls.js +2 -2
- package/dist/src/platform-symbols.js +13 -19
- package/dist/src/query.js +46 -0
- package/dist/src/references/read-rule.js +1 -0
- package/dist/src/references/read-rules.js +48 -0
- package/dist/src/references/sink.js +237 -0
- package/dist/src/references/sources.js +450 -0
- package/dist/src/references.js +110 -1285
- package/dist/src/roots/configured-declarations.js +3 -0
- package/dist/src/roots/published-reach.js +4 -4
- package/dist/src/roots/root-set.js +1 -1
- package/dist/src/roots/unseen-loads.js +38 -10
- package/dist/src/serialization-contract.js +8 -3
- package/dist/src/stores.js +4 -2
- package/dist/src/symbol-keys.js +89 -83
- package/dist/src/tests/file-class.js +76 -0
- package/dist/src/{outside-tests.js → tests/outside.js} +7 -7
- package/dist/src/{test-support.js → tests/support.js} +2 -11
- package/dist/src/type-parameter-reads.js +178 -139
- package/dist/src/unimplemented-callees.js +262 -242
- package/dist/src/verbs/analyze.js +3 -3
- package/dist/src/verbs/explain.js +75 -132
- package/dist/src/verbs/print-retained.js +3 -3
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/alias-chain.ts +0 -7
- package/src/amd.ts +130 -0
- package/src/analysis.ts +125 -128
- package/src/augmentations.ts +42 -28
- package/src/bindings.ts +460 -0
- package/src/calls.ts +338 -46
- package/src/commands/tools.ts +5 -11
- package/src/component-files.ts +4 -2
- package/src/conformance-record.ts +1 -1
- package/src/consumers.ts +8 -11
- package/src/contextual-uses.ts +2 -22
- package/src/contract/config.generated.ts +4 -1
- package/src/contract/contract.generated.ts +2 -2
- package/src/contract/report.generated.ts +6 -2
- package/src/dependencies.ts +27 -28
- package/src/destructuring.ts +1 -31
- package/src/element-access.ts +188 -182
- package/src/entries/build-scripts.ts +2 -2
- package/src/entries/configuration-files.ts +11 -8
- package/src/entries/conventions.ts +2 -1
- package/src/entries/html-entries.ts +15 -14
- package/src/entries/mdx-entries.ts +2 -2
- package/src/entries/static-module.ts +2 -1
- package/src/exempt.ts +31 -46
- package/src/exposure.ts +492 -0
- package/src/facts.ts +5 -3
- package/src/finding.ts +1 -1
- package/src/findings/boundary.ts +9 -0
- package/src/findings/completion.ts +48 -23
- package/src/findings/emitter.ts +1 -1
- package/src/findings/emitters.ts +23 -41
- package/src/{implementations.ts → findings/implementations.ts} +4 -4
- package/src/{in-operands.ts → findings/in-operands.ts} +3 -3
- package/src/findings/interfaces.ts +3 -3
- package/src/findings/intra-function.ts +3 -3
- package/src/findings/reads-and-writes.ts +99 -26
- package/src/findings/unused-declarations.ts +4 -28
- package/src/findings/visibility-narrowing.ts +25 -26
- package/src/framework-lifecycle.ts +42 -14
- package/src/import-bindings.ts +98 -29
- package/src/index/sites.ts +781 -0
- package/src/indexed-access.ts +570 -527
- package/src/interface-satisfaction.ts +2 -2
- package/src/inventory.ts +19 -0
- package/src/keyof-comparisons.ts +131 -116
- package/src/{components.ts → liveness/components.ts} +3 -3
- package/src/{graph.ts → liveness/graph.ts} +93 -27
- package/src/liveness/matrix.ts +162 -0
- package/src/liveness/sweep.ts +855 -0
- package/src/load/expected-module.ts +8 -2
- package/src/load/specifiers.ts +8 -5
- package/src/load/synthesize.ts +6 -0
- package/src/load/workspace-resolution.ts +9 -2
- package/src/module-declarations.ts +74 -98
- package/src/overrides.ts +162 -134
- package/src/paths.ts +54 -8
- package/src/platform-calls.ts +3 -3
- package/src/platform-symbols.ts +11 -27
- package/src/query.ts +81 -0
- package/src/references/read-rule.ts +60 -0
- package/src/references/read-rules.ts +55 -0
- package/src/references/sink.ts +314 -0
- package/src/references/sources.ts +632 -0
- package/src/references.ts +175 -1733
- package/src/report.ts +1 -1
- package/src/roots/configured-declarations.ts +3 -0
- package/src/roots/published-reach.ts +9 -4
- package/src/roots/root-set.ts +1 -1
- package/src/roots/unseen-loads.ts +49 -11
- package/src/serialization-contract.ts +8 -3
- package/src/stores.ts +15 -3
- package/src/symbol-keys.ts +102 -102
- package/src/tests/file-class.ts +135 -0
- package/src/{outside-tests.ts → tests/outside.ts} +16 -10
- package/src/{test-support.ts → tests/support.ts} +9 -20
- package/src/type-parameter-reads.ts +187 -158
- package/src/unimplemented-callees.ts +297 -280
- package/src/verbs/analyze.ts +3 -2
- package/src/verbs/explain.ts +83 -158
- package/src/verbs/print-retained.ts +3 -3
- package/dist/src/matrix.js +0 -273
- package/dist/src/sweep.js +0 -222
- package/src/matrix.ts +0 -463
- package/src/sweep.ts +0 -361
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isBinaryExpression,
|
|
3
|
+
isParenthesizedExpression,
|
|
4
|
+
isPropertyAccessExpression,
|
|
5
|
+
SyntaxKind,
|
|
6
|
+
type Node,
|
|
7
|
+
type SourceFile,
|
|
8
|
+
} from "@typescript/native/ast";
|
|
9
|
+
import { bindingsOf } from "../import-bindings.ts";
|
|
10
|
+
import type { Site } from "../index/sites.ts";
|
|
11
|
+
import { byPosition, renderPosition, type Position } from "../position.ts";
|
|
12
|
+
import type { ConsumerSide, Reference, Resolution, Use } from "../references.ts";
|
|
13
|
+
import { bytewise } from "../text/compare.ts";
|
|
14
|
+
|
|
15
|
+
/** One declaration a use names: `guessed` where only its name answered, `stepped` where an alias chain led to it. */
|
|
16
|
+
export interface Target {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly guessed?: boolean;
|
|
19
|
+
readonly stepped?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** One write's index among the records, by its file, with the value it stores. */
|
|
23
|
+
interface Valued {
|
|
24
|
+
readonly index: number;
|
|
25
|
+
readonly value: Node;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** One record by its file, with the node that names its target and whether `from`'s own annotation holds it. */
|
|
29
|
+
interface Named {
|
|
30
|
+
readonly index: number;
|
|
31
|
+
readonly at: Node;
|
|
32
|
+
readonly annotated: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Where every reference of one pass is made: it renders the position against the side's
|
|
37
|
+
* root, takes the writing file's test class from the file classes, marks a use only a
|
|
38
|
+
* declaration's name answered `guessed` and an alias step's `alias`, tags a consumer's
|
|
39
|
+
* reference with the consumer, and orders the records.
|
|
40
|
+
*/
|
|
41
|
+
export class Sink {
|
|
42
|
+
readonly #root: string;
|
|
43
|
+
readonly #testFile: (file: SourceFile) => boolean;
|
|
44
|
+
readonly #consumer: ConsumerSide | undefined;
|
|
45
|
+
readonly #found: Reference[] = [];
|
|
46
|
+
readonly #declaredAt: (node: Node) => string | undefined;
|
|
47
|
+
readonly #valued = new Map<SourceFile, Valued[]>();
|
|
48
|
+
readonly #named = new Map<SourceFile, Named[]>();
|
|
49
|
+
readonly #held = new Set<string>();
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
root: string,
|
|
53
|
+
testFile: (file: SourceFile) => boolean,
|
|
54
|
+
consumer: ConsumerSide | undefined,
|
|
55
|
+
declaredAt: (node: Node) => string | undefined,
|
|
56
|
+
) {
|
|
57
|
+
this.#root = root;
|
|
58
|
+
this.#testFile = testFile;
|
|
59
|
+
this.#consumer = consumer;
|
|
60
|
+
this.#declaredAt = declaredAt;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Whether a test file wrote one walked file's uses. */
|
|
64
|
+
isTest(file: SourceFile): boolean {
|
|
65
|
+
return this.#testFile(file);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The position one node of a walked file renders at. */
|
|
69
|
+
position(file: SourceFile, at: Node): Position {
|
|
70
|
+
return renderPosition(file, this.#root, at.getStart());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Records one use of each target, made by `from` at `at` in `file`. A write that stores
|
|
75
|
+
* `value` is remembered for the import bindings only its values use. A `production` use is
|
|
76
|
+
* production code's whoever writes it.
|
|
77
|
+
*/
|
|
78
|
+
add(
|
|
79
|
+
file: SourceFile,
|
|
80
|
+
at: Node | Position,
|
|
81
|
+
from: string,
|
|
82
|
+
targets: Iterable<Target | string>,
|
|
83
|
+
use: Use,
|
|
84
|
+
via: Resolution,
|
|
85
|
+
value?: Node,
|
|
86
|
+
production = false,
|
|
87
|
+
): void {
|
|
88
|
+
const position = "column" in at ? at : this.position(file, at);
|
|
89
|
+
const test = !production && this.#testFile(file);
|
|
90
|
+
for (const one of targets) {
|
|
91
|
+
const target = typeof one === "string" ? { id: one } : one;
|
|
92
|
+
this.#found.push({
|
|
93
|
+
from,
|
|
94
|
+
to: target.id,
|
|
95
|
+
position,
|
|
96
|
+
use,
|
|
97
|
+
resolution: target.guessed === true ? "by-name" : target.stepped === true ? "alias" : via,
|
|
98
|
+
test,
|
|
99
|
+
...(target.guessed === true ? { guessed: true as const } : {}),
|
|
100
|
+
});
|
|
101
|
+
if (this.#consumer === undefined && !("column" in at)) {
|
|
102
|
+
const named = this.#named.get(file) ?? [];
|
|
103
|
+
named.push({ index: this.#found.length - 1, at, annotated: this.#annotates(at, from) });
|
|
104
|
+
this.#named.set(file, named);
|
|
105
|
+
}
|
|
106
|
+
if (use === "write" && value !== undefined) {
|
|
107
|
+
const valued = this.#valued.get(file) ?? [];
|
|
108
|
+
valued.push({ index: this.#found.length - 1, value });
|
|
109
|
+
this.#valued.set(file, valued);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Whether a name sits in the annotation of `from`'s own declaration. An annotation holds
|
|
116
|
+
* no block, so the walk stops at the first declaration or block above the name.
|
|
117
|
+
*/
|
|
118
|
+
#annotates(name: Node, from: string): boolean {
|
|
119
|
+
if (name.kind === SyntaxKind.SourceFile) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
let child = name;
|
|
123
|
+
let parent = name.parent;
|
|
124
|
+
while (parent.kind !== SyntaxKind.Block && parent.kind !== SyntaxKind.SourceFile) {
|
|
125
|
+
const id = this.#declaredAt(parent);
|
|
126
|
+
if (id !== undefined) {
|
|
127
|
+
return id === from && (parent as { readonly type?: Node }).type === child;
|
|
128
|
+
}
|
|
129
|
+
child = parent;
|
|
130
|
+
parent = parent.parent;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Holds declarations an unanswered question could have made live, and the one whose read asked it. */
|
|
136
|
+
hold(ids: Iterable<string>): void {
|
|
137
|
+
for (const id of ids) {
|
|
138
|
+
this.#held.add(id);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The records made so far, before {@link finish} orders them. */
|
|
143
|
+
get made(): readonly Reference[] {
|
|
144
|
+
return this.#found;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Appends records another stage derived from these, rendered already. */
|
|
148
|
+
extend(references: readonly Reference[]): void {
|
|
149
|
+
this.#found.push(...references);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The records in position order, then the declaration named, the referencing declaration
|
|
154
|
+
* and the use, each write marked with the import bindings only its values use, and the
|
|
155
|
+
* held declarations. `usesOf` gives each walked file's name sites.
|
|
156
|
+
*/
|
|
157
|
+
finish(usesOf: ReadonlyMap<SourceFile, readonly Site[]>): {
|
|
158
|
+
readonly references: readonly Reference[];
|
|
159
|
+
readonly held: readonly string[];
|
|
160
|
+
} {
|
|
161
|
+
const found = this.#found;
|
|
162
|
+
for (const [file, writes] of this.#valued) {
|
|
163
|
+
for (const { index, names } of aloneIn(file, usesOf.get(file) ?? [], writes, found)) {
|
|
164
|
+
const reference = found[index];
|
|
165
|
+
if (reference !== undefined) {
|
|
166
|
+
found[index] = { ...reference, alone: names };
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
for (const [file, named] of this.#named) {
|
|
171
|
+
for (const { index, carriers } of carriersIn(named, this.#valued.get(file) ?? [], found)) {
|
|
172
|
+
const reference = found[index];
|
|
173
|
+
if (reference !== undefined) {
|
|
174
|
+
found[index] = { ...reference, carriers };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
found.sort(
|
|
179
|
+
(a, b) =>
|
|
180
|
+
byPosition(a.position, b.position) ||
|
|
181
|
+
bytewise(a.to, b.to) ||
|
|
182
|
+
bytewise(a.from, b.from) ||
|
|
183
|
+
bytewise(a.use, b.use),
|
|
184
|
+
);
|
|
185
|
+
const consumer = this.#consumer;
|
|
186
|
+
return {
|
|
187
|
+
references:
|
|
188
|
+
consumer === undefined
|
|
189
|
+
? found
|
|
190
|
+
: found.map((reference) => ({ ...reference, consumer: consumer.id })),
|
|
191
|
+
held: [...this.#held].sort(bytewise),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** The value one assignment stores through the name it writes, where it is a plain assignment. */
|
|
197
|
+
export function storedValue(name: Node): Node | undefined {
|
|
198
|
+
let target: Node = name;
|
|
199
|
+
if (isPropertyAccessExpression(name.parent) && name.parent.name === name) {
|
|
200
|
+
target = name.parent;
|
|
201
|
+
}
|
|
202
|
+
while (isParenthesizedExpression(target.parent)) {
|
|
203
|
+
target = target.parent;
|
|
204
|
+
}
|
|
205
|
+
const parent = target.parent;
|
|
206
|
+
return isBinaryExpression(parent) &&
|
|
207
|
+
parent.operatorToken.kind === SyntaxKind.EqualsToken &&
|
|
208
|
+
parent.left === target
|
|
209
|
+
? parent.right
|
|
210
|
+
: undefined;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The import bindings of one file that only the values written into one declaration
|
|
215
|
+
* use, for each write into it. A binding is named by an identifier that spells its
|
|
216
|
+
* local name and is not the member a property access names.
|
|
217
|
+
*/
|
|
218
|
+
function aloneIn(
|
|
219
|
+
file: SourceFile,
|
|
220
|
+
uses: readonly Site[],
|
|
221
|
+
writes: readonly Valued[],
|
|
222
|
+
found: readonly Reference[],
|
|
223
|
+
): readonly { index: number; names: readonly string[] }[] {
|
|
224
|
+
const bindings = new Set(bindingsOf(file).map((binding) => binding.name.text));
|
|
225
|
+
if (bindings.size === 0) {
|
|
226
|
+
return [];
|
|
227
|
+
}
|
|
228
|
+
const occurrences = new Map<string, Node[]>();
|
|
229
|
+
for (const site of uses) {
|
|
230
|
+
const text = site.node.getText();
|
|
231
|
+
const parent = site.node.parent;
|
|
232
|
+
if (!bindings.has(text) || (isPropertyAccessExpression(parent) && parent.name === site.node)) {
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (!occurrences.get(text)?.includes(site.node)) {
|
|
236
|
+
occurrences.set(text, [...(occurrences.get(text) ?? []), site.node]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const inside = (node: Node, value: Node): boolean =>
|
|
240
|
+
node.pos >= value.pos && node.end <= value.end;
|
|
241
|
+
const result: { index: number; names: readonly string[] }[] = [];
|
|
242
|
+
for (const write of writes) {
|
|
243
|
+
const to = found[write.index]?.to;
|
|
244
|
+
const sameTarget = writes.filter((one) => found[one.index]?.to === to);
|
|
245
|
+
const names = [...occurrences]
|
|
246
|
+
.filter(
|
|
247
|
+
([, nodes]) =>
|
|
248
|
+
nodes.some((node) => inside(node, write.value)) &&
|
|
249
|
+
nodes.every((node) => sameTarget.some((one) => inside(node, one.value))),
|
|
250
|
+
)
|
|
251
|
+
.map(([name]) => name)
|
|
252
|
+
.sort(bytewise);
|
|
253
|
+
if (names.length > 0) {
|
|
254
|
+
result.push({ index: write.index, names });
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The carriers of each named record of one file: `from` where its own annotation holds the
|
|
262
|
+
* name, then the target of each write whose stored value holds it and that names another
|
|
263
|
+
* declaration, the innermost value first. Values nest or are disjoint.
|
|
264
|
+
*/
|
|
265
|
+
function carriersIn(
|
|
266
|
+
named: readonly Named[],
|
|
267
|
+
writes: readonly Valued[],
|
|
268
|
+
found: readonly Reference[],
|
|
269
|
+
): readonly { index: number; carriers: readonly string[] }[] {
|
|
270
|
+
const byStart = [...named].sort((a, b) => a.at.pos - b.at.pos);
|
|
271
|
+
const holding = new Map<number, Valued[]>();
|
|
272
|
+
for (const write of writes) {
|
|
273
|
+
let low = 0;
|
|
274
|
+
let high = byStart.length;
|
|
275
|
+
while (low < high) {
|
|
276
|
+
const middle = (low + high) >>> 1;
|
|
277
|
+
if ((byStart[middle]?.at.pos ?? 0) < write.value.pos) {
|
|
278
|
+
low = middle + 1;
|
|
279
|
+
} else {
|
|
280
|
+
high = middle;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
for (let at = low; at < byStart.length; at += 1) {
|
|
284
|
+
const one = byStart[at];
|
|
285
|
+
if (one === undefined || one.at.pos >= write.value.end) {
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
if (one.at.end <= write.value.end) {
|
|
289
|
+
holding.set(one.index, [...(holding.get(one.index) ?? []), write]);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const result: { index: number; carriers: readonly string[] }[] = [];
|
|
294
|
+
for (const one of named) {
|
|
295
|
+
const reference = found[one.index];
|
|
296
|
+
if (reference === undefined) {
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const carriers = one.annotated ? [reference.from] : [];
|
|
300
|
+
const values = [...(holding.get(one.index) ?? [])].sort(
|
|
301
|
+
(a, b) => a.value.end - a.value.pos - (b.value.end - b.value.pos),
|
|
302
|
+
);
|
|
303
|
+
for (const write of values) {
|
|
304
|
+
const to = found[write.index]?.to;
|
|
305
|
+
if (to !== undefined && to !== reference.to && !carriers.includes(to)) {
|
|
306
|
+
carriers.push(to);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (carriers.length > 0) {
|
|
310
|
+
result.push({ index: one.index, carriers });
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return result;
|
|
314
|
+
}
|