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

Function getDeclarationTNode

packages/core/src/render3/state.ts:542–560  ·  view source on GitHub ↗

* Returns a `TNode` of the location where the current `LView` is declared at. * * @param lView an `LView` that we want to find parent `TNode` for.

(lView: LView)

Source from the content-addressed store, hash-verified

540 * @param lView an `LView` that we want to find parent `TNode` for.
541 */
542function getDeclarationTNode(lView: LView): TNode | null {
543 const tView = lView[TVIEW];
544
545 // Return the declaration parent for embedded views
546 if (tView.type === TViewType.Embedded) {
547 ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');
548 return tView.declTNode;
549 }
550
551 // Components don't have `TView.declTNode` because each instance of component could be
552 // inserted in different location, hence `TView.declTNode` is meaningless.
553 // Falling back to `T_HOST` in case we cross component boundary.
554 if (tView.type === TViewType.Component) {
555 return lView[T_HOST];
556 }
557
558 // Remaining TNode type is `TViewType.Root` which doesn't have a parent TNode.
559 return null;
560}
561
562/**
563 * This is a light weight version of the `enterView` which is needed by the DI system.

Callers 1

enterDIFunction · 0.85

Calls 1

assertDefinedFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…