MCPcopy Index your code
hub / github.com/angular/angular / toPath

Method toPath

packages/compiler-cli/src/ngtsc/cycles/src/imports.ts:161–171  ·  view source on GitHub ↗

* Back track through this found SourceFile and its ancestors to generate an array of * SourceFiles that form am import path between two SourceFiles.

()

Source from the content-addressed store, hash-verified

159 * SourceFiles that form am import path between two SourceFiles.
160 */
161 toPath(): ts.SourceFile[] {
162 const array: ts.SourceFile[] = [];
163 let current: Found | null = this;
164 while (current !== null) {
165 array.push(current.sourceFile);
166 current = current.parent;
167 }
168 // Pushing and then reversing, O(n), rather than unshifting repeatedly, O(n^2), avoids
169 // manipulating the array on every iteration: https://stackoverflow.com/a/26370620
170 return array.reverse();
171 }
172}

Callers 4

findPathMethod · 0.95
getSourceFileMethod · 0.80
getSourceFileMethod · 0.80
onDidOpenTextDocumentMethod · 0.80

Calls 2

reverseMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected