refactor(ivy): limit reads from TView.consts (#33856)

PR Close #33856
This commit is contained in:
Pawel Kozlowski 2019-11-15 15:57:27 +01:00 committed by Alex Rickabaugh
parent 3557849371
commit ad4300f52b
2 changed files with 6 additions and 4 deletions

View File

@ -74,10 +74,11 @@ export function ɵɵtemplate(
// TODO: consider a separate node type for templates
const tContainerNode = containerInternal(
lView, index, tagName || null, getConstant<TAttributes>(tViewConsts, attrsIndex));
const localRefs = getConstant<string[]>(tViewConsts, localRefsIndex);
if (tView.firstCreatePass) {
ngDevMode && ngDevMode.firstCreatePass++;
resolveDirectives(tView, lView, tContainerNode, localRefs);
resolveDirectives(
tView, lView, tContainerNode, getConstant<string[]>(tViewConsts, localRefsIndex));
registerPostOrderHooks(tView, tContainerNode);
const embeddedTView = tContainerNode.tViews = createTView(
@ -96,7 +97,8 @@ export function ɵɵtemplate(
if (isDirectiveHost(tContainerNode)) {
createDirectivesInstances(tView, lView, tContainerNode);
}
if (localRefs != null) {
if (localRefsIndex !== null) {
saveResolvedLocalsInData(lView, tContainerNode, localRefExtractor);
}

View File

@ -555,7 +555,7 @@ export function saveResolvedLocalsInData(
viewData: LView, tNode: TDirectiveHostNode,
localRefExtractor: LocalRefExtractor = getNativeByTNode): void {
const localNames = tNode.localNames;
if (localNames) {
if (localNames !== null) {
let localIndex = tNode.index + 1;
for (let i = 0; i < localNames.length; i += 2) {
const index = localNames[i + 1] as number;