refactor(ivy): clean up RNode retrieval; add better debug support for TNode (#31040)

PR Close #31040
This commit is contained in:
Misko Hevery
2019-06-14 07:55:17 +02:00
committed by Miško Hevery
parent ef75fb8ecd
commit 4495a46b99
14 changed files with 201 additions and 59 deletions

View File

@ -14,7 +14,7 @@ import {LContext, MONKEY_PATCH_KEY_NAME} from './interfaces/context';
import {TNode, TNodeFlags} from './interfaces/node';
import {RElement, RNode} from './interfaces/renderer';
import {CONTEXT, HEADER_OFFSET, HOST, LView, TVIEW} from './interfaces/view';
import {getComponentViewByIndex, getNativeByTNode, readPatchedData, unwrapRNode} from './util/view_utils';
import {getComponentViewByIndex, getNativeByTNodeOrNull, readPatchedData, unwrapRNode} from './util/view_utils';
@ -191,7 +191,7 @@ export function isDirectiveInstance(instance: any): boolean {
function findViaNativeElement(lView: LView, target: RElement): number {
let tNode = lView[TVIEW].firstChild;
while (tNode) {
const native = getNativeByTNode(tNode, lView) !;
const native = getNativeByTNodeOrNull(tNode, lView) !;
if (native === target) {
return tNode.index;
}