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) { export function assertIndexInVarsRange(lView: LView, index: number) {
const tView = lView[1]; const tView = lView[1];
assertBetween( assertBetween(tView.bindingStartIndex, tView.expandoStartIndex, index);
tView.bindingStartIndex,
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex, index);
} }
export function assertIndexInExpandoRange(lView: LView, index: number) { export function assertIndexInExpandoRange(lView: LView, index: number) {
const tView = lView[1]; const tView = lView[1];
assertBetween( assertBetween(tView.expandoStartIndex, lView.length, index);
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex, lView.length,
index);
} }
export function assertBetween(lower: number, upper: number, index: number) { 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 { get type_(): string {
return TViewTypeAsString[this.type] || `TViewType.?${this.type}?`; 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 { class TNode implements ITNode {
@ -515,18 +505,13 @@ export class LViewDebug implements ILViewDebug {
} }
get vars(): LViewDebugRange { get vars(): LViewDebugRange {
const tView = this.tView;
return toLViewRange( return toLViewRange(
tView, this._raw_lView, tView.bindingStartIndex, this.tView, this._raw_lView, this.tView.bindingStartIndex, this.tView.expandoStartIndex);
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex);
} }
get expando(): LViewDebugRange { get expando(): LViewDebugRange {
const tView = this.tView as any as {_decls: number, _vars: number};
return toLViewRange( return toLViewRange(
this.tView, this._raw_lView, this.tView, this._raw_lView, this.tView.expandoStartIndex, this._raw_lView.length);
(tView as any as {originalExpandoStartIndex: number}).originalExpandoStartIndex,
this._raw_lView.length);
} }
/** /**