refactor(ivy): remove the getHostNative utility function (#33554)

We already store a reference to a native host of a component
view so we can drop the getHostNative utility function (that
was getting the same reference from another data structure).

PR Close #33554
This commit is contained in:
Pawel Kozlowski 2019-11-03 12:06:39 +01:00 committed by atscott
parent 66725b7b37
commit 4ff43e1324
4 changed files with 3 additions and 29 deletions

View File

@ -20,7 +20,7 @@ import {ProceduralRenderer3, RElement, RNode, RText, Renderer3, isProceduralRend
import {isLContainer, isLView, isRootView} from './interfaces/type_checks';
import {CHILD_HEAD, CLEANUP, DECLARATION_LCONTAINER, FLAGS, HOST, HookData, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, TVIEW, T_HOST, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
import {assertNodeOfPossibleTypes, assertNodeType} from './node_assert';
import {findComponentView, getLViewParent} from './util/view_traversal_utils';
import {findComponentView} from './util/view_traversal_utils';
import {getNativeByTNode, getNativeByTNodeOrNull, unwrapRNode} from './util/view_utils';
const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
@ -515,7 +515,8 @@ function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
} else {
// We are inserting a root element of the component view into the component host element and
// it should always be eager.
return getHostNative(currentView);
ngDevMode && assertNodeOfPossibleTypes(hostTNode, TNodeType.Element);
return currentView[HOST];
}
} else {
const isIcuCase = tNode && tNode.type === TNodeType.IcuContainer;
@ -547,18 +548,6 @@ function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
}
}
/**
* Gets the native host element for a given view. Will return null if the current view does not have
* a host element.
*/
function getHostNative(currentView: LView): RElement|null {
ngDevMode && assertLView(currentView);
const hostTNode = currentView[T_HOST];
return hostTNode && hostTNode.type === TNodeType.Element ?
(getNativeByTNode(hostTNode, getLViewParent(currentView) !) as RElement) :
null;
}
/**
* Inserts a native node before another native node for a given parent using {@link Renderer3}.
* This is a utility function that can be used when native nodes were determined - it abstracts an

View File

@ -311,9 +311,6 @@
{
"name": "getFactoryDef"
},
{
"name": "getHostNative"
},
{
"name": "getInitialStylingValue"
},
@ -329,9 +326,6 @@
{
"name": "getLView"
},
{
"name": "getLViewParent"
},
{
"name": "getMapProp"
},

View File

@ -245,9 +245,6 @@
{
"name": "getFactoryDef"
},
{
"name": "getHostNative"
},
{
"name": "getInjectorIndex"
},
@ -260,9 +257,6 @@
{
"name": "getLView"
},
{
"name": "getLViewParent"
},
{
"name": "getNativeAnchorNode"
},

View File

@ -671,9 +671,6 @@
{
"name": "getGuardMask"
},
{
"name": "getHostNative"
},
{
"name": "getInitialStylingValue"
},