refactor(ivy): replace enter / leave view with selectView (#32263)

After a series of recent refactorings `enterView` and `leaveView` became
identical. This PR merges both into one concept of view selectio (similar
to a node selection). This reduces number of concepts and code size.

PR Close #32263
This commit is contained in:
Pawel Kozlowski
2019-08-22 11:43:24 +02:00
committed by atscott
parent e3422e0aed
commit e63a7b0532
10 changed files with 35 additions and 54 deletions

View File

@ -23,7 +23,7 @@ import {TElementNode, TNode, TNodeType} from './interfaces/node';
import {PlayerHandler} from './interfaces/player';
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
import {CONTEXT, HEADER_OFFSET, LView, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
import {enterView, getPreviousOrParentTNode, leaveView, resetComponentState, setActiveHostElement} from './state';
import {getPreviousOrParentTNode, resetComponentState, selectView, setActiveHostElement} from './state';
import {publishDefaultGlobalUtils} from './util/global_utils';
import {defaultScheduler, stringifyForError} from './util/misc_utils';
import {getRootContext} from './util/view_traversal_utils';
@ -133,7 +133,7 @@ export function renderComponent<T>(
null, rootTView, rootContext, rootFlags, null, null, rendererFactory, renderer, undefined,
opts.injector || null);
const oldView = enterView(rootView, null);
const oldView = selectView(rootView, null);
let component: T;
try {
@ -149,7 +149,7 @@ export function renderComponent<T>(
refreshView(rootView, rootTView, null, null);
} finally {
leaveView(oldView);
selectView(oldView, null);
if (rendererFactory.end) rendererFactory.end();
}