perf(ivy): attempt to coalesce listeners only in presence of directives (#29859)

PR Close #29859
This commit is contained in:
Pawel Kozlowski
2019-04-12 10:34:38 +02:00
committed by Alex Rickabaugh
parent d1d0f4a1ad
commit 6a1441f727
3 changed files with 18 additions and 4 deletions

View File

@ -131,6 +131,13 @@ export function getNativeByTNode(tNode: TNode, hostView: LView): RNode {
return unwrapRNode(hostView[tNode.index]);
}
/**
* A helper function that returns `true` if a given `TNode` has any matching directives.
*/
export function hasDirectives(tNode: TNode): boolean {
return tNode.directiveEnd > tNode.directiveStart;
}
export function getTNode(index: number, view: LView): TNode {
ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
ngDevMode && assertLessThan(index, view[TVIEW].data.length, 'wrong index for TNode');