* 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)
| 540 | * @param lView an `LView` that we want to find parent `TNode` for. |
| 541 | */ |
| 542 | function 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. |
no test coverage detected
searching dependent graphs…