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

Method constructor

packages/core/src/di/r3_injector.ts:216–244  ·  view source on GitHub ↗
(
    providers: Array<Provider | EnvironmentProviders>,
    readonly parent: Injector,
    readonly source: string | null,
    readonly scopes: Set<InjectorScope>,
  )

Source from the content-addressed store, hash-verified

214 private injectorDefTypes: Set<Type<unknown>>;
215
216 constructor(
217 providers: Array<Provider | EnvironmentProviders>,
218 readonly parent: Injector,
219 readonly source: string | null,
220 readonly scopes: Set<InjectorScope>,
221 ) {
222 super();
223 // Start off by creating Records for every provider.
224 forEachSingleProvider(providers as Array<Provider | InternalEnvironmentProviders>, (provider) =>
225 this.processProvider(provider),
226 );
227
228 // Make sure the INJECTOR token provides this injector.
229 this.records.set(INJECTOR, makeRecord(undefined, this));
230
231 // And `EnvironmentInjector` if the current injector is supposed to be env-scoped.
232 if (scopes.has('environment')) {
233 this.records.set(EnvironmentInjector, makeRecord(undefined, this));
234 }
235
236 // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide
237 // any injectable scoped to APP_ROOT_SCOPE.
238 const record = this.records.get(INJECTOR_SCOPE) as Record<InjectorScope | null>;
239 if (record != null && typeof record.value === 'string') {
240 this.scopes.add(record.value as InjectorScope);
241 }
242
243 this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, {self: true}));
244 }
245
246 retrieve<T>(token: PrimitivesInjectionToken<T>, options?: unknown): T | NotFound {
247 const flags: InternalInjectFlags =

Callers

nothing calls this directly

Calls 8

processProviderMethod · 0.95
getMethod · 0.95
forEachSingleProviderFunction · 0.85
makeRecordFunction · 0.85
setMethod · 0.65
hasMethod · 0.65
getMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected