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

Function patchComponentDefWithScope

packages/core/src/render3/jit/module.ts:528–547  ·  view source on GitHub ↗
(
  componentDef: ComponentDef<C>,
  transitiveScopes: NgModuleTransitiveScopes,
)

Source from the content-addressed store, hash-verified

526 * a given module.
527 */
528export function patchComponentDefWithScope<C>(
529 componentDef: ComponentDef<C>,
530 transitiveScopes: NgModuleTransitiveScopes,
531) {
532 componentDef.directiveDefs = () =>
533 Array.from(transitiveScopes.compilation.directives)
534 .map((dir) =>
535 dir.hasOwnProperty(NG_COMP_DEF) ? getComponentDef(dir)! : getDirectiveDef(dir)!,
536 )
537 .filter((def) => !!def);
538 componentDef.pipeDefs = () =>
539 Array.from(transitiveScopes.compilation.pipes).map((pipe) => getPipeDef(pipe)!);
540 componentDef.schemas = transitiveScopes.schemas;
541
542 // Since we avoid Components/Directives/Pipes recompiling in case there are no overrides, we
543 // may face a problem where previously compiled defs available to a given Component/Directive
544 // are cached in TView and may become stale (in case any of these defs gets recompiled). In
545 // order to avoid this problem, we force fresh TView to be created.
546 componentDef.tView = null;
547}
548
549/**
550 * Compute the pair of transitive scopes (compilation scope and exported scope) for a given type

Callers 3

compileComponentFunction · 0.90
applyTransitiveScopesMethod · 0.85

Calls 5

getComponentDefFunction · 0.90
getDirectiveDefFunction · 0.90
getPipeDefFunction · 0.90
mapMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…