refactor(core): Ensure that previousOrParentTNode always belongs to current TView. (#38707)

`previousOrParentTNode` stores current `TNode`. Due to inconsistent
implementation the value stored would sometimes belong to the current
`TView` and sometimes to the parent. We have extra logic which accounts
for it. A better solution is to just ensure that `previousOrParentTNode`
always belongs to current `TNode`. This simplifies the mental model
and cleans up some code.

PR Close #38707
This commit is contained in:
Misko Hevery
2020-09-03 22:46:11 -07:00
committed by Alex Rickabaugh
parent 2ede800f0c
commit 812615bb99
21 changed files with 63 additions and 29 deletions

View File

@ -459,7 +459,9 @@ describe('Runtime i18n', () => {
const nbConsts = 2;
const index = 1;
const opCodes = getOpCodes(attrs, () => {
ɵɵelementStart(0, 'div');
ɵɵi18nAttributes(index, 0);
ɵɵelementEnd();
}, null, nbConsts, index);
expect(opCodes).toEqual(debugMatch([
@ -473,7 +475,9 @@ describe('Runtime i18n', () => {
const nbConsts = 2;
const index = 1;
const opCodes = getOpCodes(attrs, () => {
ɵɵelementStart(0, 'div');
ɵɵi18nAttributes(index, 0);
ɵɵelementEnd();
}, null, nbConsts, index);
expect(opCodes).toEqual(debugMatch([
@ -487,7 +491,9 @@ describe('Runtime i18n', () => {
const nbConsts = 2;
const index = 1;
const opCodes = getOpCodes(attrs, () => {
ɵɵelementStart(0, 'div');
ɵɵi18nAttributes(index, 0);
ɵɵelementEnd();
}, null, nbConsts, index);
expect(opCodes).toEqual(debugMatch([