refactor(core): remove expandoStartIndex workaround (#39416)

This commit removes a workaround to calculate the `expandoStartIndex` value. That workaround was needed
because the `expandoStartIndex` was updated previously, so it pointed at the wrong location. The problem
was fixed in PR #39301 and the workaround is no longer needed.

PR Close #39416
This commit is contained in:
Andrew Kushnir 2020-10-24 22:26:23 -07:00 committed by Alex Rickabaugh
parent 3c6edcdf93
commit b56cc4059f
2 changed files with 4 additions and 23 deletions

View File

@ -121,16 +121,12 @@ export function assertIndexInDeclRange(lView: LView, index: number) {
export function assertIndexInVarsRange(lView: LView, index: number) {
const tView = lView[1];
assertBetween(
tView.bindingStartIndex,
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex, index);
assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
}
export function assertIndexInExpandoRange(lView: LView, index: number) {
const tView = lView[1];
assertBetween(
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex, lView.length,
index);
assertBetween(tView.expandoStartIndex, lView.length, index);
}
export function assertBetween(lower: number, upper: number, index: number) {

View File

@ -159,16 +159,6 @@ export const TViewConstructor = class TView implements ITView {
get type_(): string {
return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`;
}
/**
* Returns initial value of `expandoStartIndex`.
*/
// FIXME(misko): `originalExpandoStartIndex` should not be needed because it should be the same as
// `expandoStartIndex`. However `expandoStartIndex` is misnamed as it changes as more items get
// allocated in expando.
get originalExpandoStartIndex(): number {
return HEADER_OFFSET + this._decls + this._vars;
}
};
class TNode implements ITNode {
@ -515,18 +505,13 @@ export class LViewDebug implements ILViewDebug {
}
get vars(): LViewDebugRange {
const tView = this.tView;
return toLViewRange(
tView, this._raw_lView, tView.bindingStartIndex,
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex);
this.tView, this._raw_lView, this.tView.bindingStartIndex, this.tView.expandoStartIndex);
}
get expando(): LViewDebugRange {
const tView = this.tView as any as {_decls: number, _vars: number};
return toLViewRange(
this.tView, this._raw_lView,
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex,
this._raw_lView.length);
this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
}
/**