fixup! refactor(ivy): simplify context discover based on feedback (#28101)

PR Close #28101
This commit is contained in:
Kristiyan Kostadinov 2019-01-14 21:36:04 +01:00 committed by Andrew Kushnir
parent b6510a320b
commit 60fecc1284
1 changed files with 3 additions and 8 deletions

View File

@ -300,14 +300,9 @@ export function discoverLocalRefs(lView: LView, nodeIndex: number): {[key: strin
if (tNode && tNode.localNames) {
const result: {[key: string]: any} = {};
let localIndex = tNode.index + 1;
for (let i = 0; i < tNode.localNames.length; i += 2, localIndex++) {
const localRefName = tNode.localNames[i];
const directiveIndex = tNode.localNames[i + 1] as number;
if (directiveIndex === -1) {
result[localRefName] = lView[localIndex] || getNativeByTNode(tNode, lView);
} else {
result[localRefName] = lView[directiveIndex];
}
for (let i = 0; i < tNode.localNames.length; i += 2) {
result[tNode.localNames[i]] = lView[localIndex];
localIndex++;
}
return result;
}