refactor(ivy): adjust types, limit usage of global state (#28473)

PR Close #28473
This commit is contained in:
Pawel Kozlowski 2019-01-31 11:44:27 +01:00 committed by Matias Niemelä
parent 9efb39c8a2
commit 6656328538
1 changed files with 9 additions and 9 deletions

View File

@ -2091,23 +2091,23 @@ export function template(
localRefExtractor?: LocalRefExtractor) { localRefExtractor?: LocalRefExtractor) {
const lView = getLView(); const lView = getLView();
const tView = lView[TVIEW]; const tView = lView[TVIEW];
// TODO: consider a separate node type for templates
const tNode = containerInternal(index, tagName || null, attrs || null);
// TODO: consider a separate node type for templates
const tContainerNode = containerInternal(index, tagName || null, attrs || null);
if (tView.firstTemplatePass) { if (tView.firstTemplatePass) {
tNode.tViews = createTView( tContainerNode.tViews = createTView(
-1, templateFn, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null); -1, templateFn, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null);
} }
createDirectivesAndLocals(tView, lView, localRefs, localRefExtractor); createDirectivesAndLocals(tView, lView, localRefs, localRefExtractor);
const currentQueries = lView[QUERIES]; const currentQueries = lView[QUERIES];
const previousOrParentTNode = getPreviousOrParentTNode();
const native = getNativeByTNode(previousOrParentTNode, lView);
attachPatchData(native, lView);
if (currentQueries) { if (currentQueries) {
lView[QUERIES] = currentQueries.addNode(previousOrParentTNode as TContainerNode); lView[QUERIES] = currentQueries.addNode(tContainerNode);
} }
registerPostOrderHooks(tView, tNode);
attachPatchData(getNativeByTNode(tContainerNode, lView), lView);
registerPostOrderHooks(tView, tContainerNode);
setIsParent(false); setIsParent(false);
} }
@ -2130,7 +2130,7 @@ export function container(index: number): void {
} }
function containerInternal( function containerInternal(
index: number, tagName: string | null, attrs: TAttributes | null): TNode { index: number, tagName: string | null, attrs: TAttributes | null): TContainerNode {
const lView = getLView(); const lView = getLView();
ngDevMode && assertEqual( ngDevMode && assertEqual(
lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex, lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex,