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

Function serializeAncestors

packages/core/src/debug/ai/di_graph.ts:168–192  ·  view source on GitHub ↗

* Serialize all the ancestors of the given injector and return * its serialized version. * * @param injector The environment injector to start from. * @returns The serialized form of the input Injector.

(injector: Injector)

Source from the content-addressed store, hash-verified

166 * @returns The serialized form of the input {@link Injector}.
167 */
168 function serializeAncestors(injector: Injector): SerializedInjector {
169 const existing = serializedEnvInjectorMap.get(injector);
170 if (existing) return existing;
171
172 const serialized = serializeInjector(injector);
173 serializedEnvInjectorMap.set(injector, serialized);
174
175 const parentInjector = getParentEnvInjector(injector);
176 if (parentInjector) {
177 // Recursively process the parent and attach ourselves as a child.
178 const parentSerialized = serializeAncestors(parentInjector);
179 parentSerialized.children.push(serialized);
180 } else {
181 // If there is no parent, this is a root environment injector.
182 if (!rootEnvInjector) {
183 rootEnvInjector = serialized;
184 } else if (rootEnvInjector !== serialized) {
185 throw new Error('Expected only one root environment injector, but found multiple.', {
186 cause: {firstRoot: rootEnvInjector, secondRoot: serialized},
187 });
188 }
189 }
190
191 return serialized;
192 }
193
194 // Process all descendant environment injectors.
195 for (const rootLView of rootLViews) {

Callers 1

collectEnvInjectorsFunction · 0.85

Calls 5

serializeInjectorFunction · 0.90
getParentEnvInjectorFunction · 0.85
getMethod · 0.65
setMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…