fix(ivy): avoid cyclical dependency in imports (#33831)

This commit moves the `setLContainerActiveIndex` and `getLContainerActiveIndex` functions used in a few files to a common `util/view_util.ts` lib to avoid cyclical dependency while importing `instructions/container.ts` where these functions located originally.

PR Close #33831
This commit is contained in:
Andrew Kushnir
2019-11-14 10:49:15 -08:00
committed by Alex Rickabaugh
parent eca85d5880
commit 96c9ccc81a
5 changed files with 16 additions and 18 deletions

View File

@ -8,7 +8,7 @@
import {assertDataInRange, assertDefined, assertDomNode, assertGreaterThan, assertLessThan} from '../../util/assert';
import {assertTNodeForLView} from '../assert';
import {LContainer, TYPE} from '../interfaces/container';
import {ACTIVE_INDEX, ActiveIndexFlag, LContainer, TYPE} from '../interfaces/container';
import {LContext, MONKEY_PATCH_KEY_NAME} from '../interfaces/context';
import {TConstants, TNode} from '../interfaces/node';
import {RNode, isProceduralRenderer} from '../interfaces/renderer';
@ -188,3 +188,11 @@ export function getConstant<T>(consts: TConstants | null, index: number | null |
export function resetPreOrderHookFlags(lView: LView) {
lView[PREORDER_HOOK_FLAGS] = 0;
}
export function getLContainerActiveIndex(lContainer: LContainer) {
return lContainer[ACTIVE_INDEX] >> ActiveIndexFlag.SHIFT;
}
export function setLContainerActiveIndex(lContainer: LContainer, index: number) {
lContainer[ACTIVE_INDEX] = index << ActiveIndexFlag.SHIFT;
}