refactor(ivy): remove duplicated getRootView function (#28732)

PR Close #28732
This commit is contained in:
Pawel Kozlowski 2019-02-14 16:28:31 +01:00 committed by Misko Hevery
parent 2e3cc45c74
commit c1094cf46f
2 changed files with 3 additions and 26 deletions

View File

@ -18,12 +18,12 @@ import {getComponentDef} from './definition';
import {diPublicInInjector, getOrCreateNodeInjectorForNode} from './di';
import {publishDefaultGlobalUtils} from './global_utils';
import {registerPostOrderHooks, registerPreOrderHooks} from './hooks';
import {CLEAN_PROMISE, addToViewTree, createLView, createNodeAtIndex, createTNode, createTView, getOrCreateTView, initNodeFlags, instantiateRootComponent, invokeHostBindingsInCreationMode, locateHostElement, queueComponentIndexForCheck, refreshDescendantViews} from './instructions';
import {CLEAN_PROMISE, addToViewTree, createLView, createNodeAtIndex, createTView, getOrCreateTView, initNodeFlags, instantiateRootComponent, invokeHostBindingsInCreationMode, locateHostElement, queueComponentIndexForCheck, refreshDescendantViews} from './instructions';
import {ComponentDef, ComponentType, RenderFlags} from './interfaces/definition';
import {TElementNode, TNode, TNodeFlags, TNodeType} from './interfaces/node';
import {PlayerHandler} from './interfaces/player';
import {RElement, Renderer3, RendererFactory3, domRendererFactory3} from './interfaces/renderer';
import {CONTEXT, FLAGS, HEADER_OFFSET, HOST, LView, LViewFlags, RootContext, RootContextFlags, TVIEW, T_HOST} from './interfaces/view';
import {CONTEXT, FLAGS, HEADER_OFFSET, LView, LViewFlags, RootContext, RootContextFlags, TVIEW} from './interfaces/view';
import {enterView, getPreviousOrParentTNode, leaveView, resetComponentState, setCurrentDirectiveDef} from './state';
import {applyOnCreateInstructions, defaultScheduler, getRootView, readPatchedLView, renderStringify} from './util';

View File

@ -8,14 +8,13 @@
import {Injector} from '../di/injector';
import {assertDefined} from '../util/assert';
import {discoverLocalRefs, getComponentAtNodeIndex, getDirectivesAtNodeIndex, getLContext} from './context_discovery';
import {NodeInjector} from './di';
import {LContext} from './interfaces/context';
import {DirectiveDef} from './interfaces/definition';
import {TElementNode, TNode, TNodeProviderIndexes} from './interfaces/node';
import {CLEANUP, CONTEXT, FLAGS, HOST, LView, LViewFlags, PARENT, RootContext, TVIEW} from './interfaces/view';
import {readElementValue, readPatchedLView, renderStringify} from './util';
import {getRootView, readElementValue, renderStringify} from './util';
@ -207,28 +206,6 @@ export function loadLContext(target: {}, throwOnNotFound: boolean = true): LCont
return context;
}
/**
* Retrieve the root view from any component by walking the parent `LView` until
* reaching the root `LView`.
*
* @param componentOrView any component or view
*
*/
export function getRootView(componentOrView: LView | {}): LView {
let lView: LView;
if (Array.isArray(componentOrView)) {
ngDevMode && assertDefined(componentOrView, 'lView');
lView = componentOrView as LView;
} else {
ngDevMode && assertDefined(componentOrView, 'component');
lView = readPatchedLView(componentOrView) !;
}
while (lView && !(lView[FLAGS] & LViewFlags.IsRoot)) {
lView = lView[PARENT] !;
}
return lView;
}
/**
* Retrieve map of local references.
*