Skip to content

Commit

Permalink
refactor(core): remove deprecated ɵɵselect instruction (#38733)
Browse files Browse the repository at this point in the history
This instruction was deprecated in 664e001
and is no longer referenced in any meaningful
way, so it can be removed.

PR Close #38733
  • Loading branch information
petebacondarwin authored and atscott committed Sep 8, 2020
1 parent 5863537 commit ee432aa
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 21 deletions.
1 change: 0 additions & 1 deletion packages/compiler/src/render3/r3_identifiers.ts
Expand Up @@ -29,7 +29,6 @@ export class Identifiers {

static elementEnd: o.ExternalReference = {name: 'ɵɵelementEnd', moduleName: CORE};

static select: o.ExternalReference = {name: 'ɵɵselect', moduleName: CORE};
static advance: o.ExternalReference = {name: 'ɵɵadvance', moduleName: CORE};

static syntheticHostProperty:
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/core_render3_private_export.ts
Expand Up @@ -201,7 +201,6 @@ export {
ɵɵresolveWindow,
ɵɵrestoreView,

ɵɵselect,
ɵɵsetComponentScope,
ɵɵsetNgModuleScope,
ɵɵstaticContentQuery,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/render3/index.ts
Expand Up @@ -88,8 +88,6 @@ export {

ɵɵreference,

// TODO: remove `select` once we've refactored all of the tests not to use it.
ɵɵselect,
ɵɵstyleMap,
ɵɵstyleMapInterpolate1,
ɵɵstyleMapInterpolate2,
Expand Down
10 changes: 0 additions & 10 deletions packages/core/src/render3/instructions/advance.ts
Expand Up @@ -39,16 +39,6 @@ export function ɵɵadvance(delta: number): void {
selectIndexInternal(getTView(), getLView(), getSelectedIndex() + delta, getCheckNoChangesMode());
}

/**
* Selects an element for later binding instructions.
* @deprecated No longer being generated, but still used in unit tests.
* @codeGenApi
*/
export function ɵɵselect(index: number): void {
// TODO(misko): Remove this function as it is no longer being used.
selectIndexInternal(getTView(), getLView(), index, getCheckNoChangesMode());
}

export function selectIndexInternal(
tView: TView, lView: LView, index: number, checkNoChangesMode: boolean) {
ngDevMode && assertGreaterThan(index, -1, 'Invalid index');
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/render3/jit/environment.ts
Expand Up @@ -134,7 +134,6 @@ export const angularCoreEnv: {[name: string]: Function} =
'ɵɵstylePropInterpolate8': r3.ɵɵstylePropInterpolate8,
'ɵɵstylePropInterpolateV': r3.ɵɵstylePropInterpolateV,
'ɵɵclassProp': r3.ɵɵclassProp,
'ɵɵselect': r3.ɵɵselect,
'ɵɵadvance': r3.ɵɵadvance,
'ɵɵtemplate': r3.ɵɵtemplate,
'ɵɵtext': r3.ɵɵtext,
Expand Down
12 changes: 6 additions & 6 deletions packages/core/test/render3/instructions_spec.ts
Expand Up @@ -10,7 +10,7 @@ import {NgForOfContext} from '@angular/common';
import {getSortedClassName} from '@angular/core/testing/src/styling';

import {ɵɵdefineComponent} from '../../src/render3/definition';
import {RenderFlags, ɵɵattribute, ɵɵclassMap, ɵɵelement, ɵɵelementEnd, ɵɵelementStart, ɵɵproperty, ɵɵselect, ɵɵstyleMap, ɵɵstyleProp, ɵɵtemplate, ɵɵtext, ɵɵtextInterpolate1} from '../../src/render3/index';
import {RenderFlags, ɵɵadvance, ɵɵattribute, ɵɵclassMap, ɵɵelement, ɵɵelementEnd, ɵɵelementStart, ɵɵproperty, ɵɵstyleMap, ɵɵstyleProp, ɵɵtemplate, ɵɵtext, ɵɵtextInterpolate1} from '../../src/render3/index';
import {AttributeMarker} from '../../src/render3/interfaces/node';
import {bypassSanitizationTrustHtml, bypassSanitizationTrustResourceUrl, bypassSanitizationTrustScript, bypassSanitizationTrustStyle, bypassSanitizationTrustUrl, getSanitizationBypassType, SafeValue, unwrapSafeValue} from '../../src/sanitization/bypass';
import {ɵɵsanitizeHtml, ɵɵsanitizeResourceUrl, ɵɵsanitizeScript, ɵɵsanitizeStyle, ɵɵsanitizeUrl} from '../../src/sanitization/sanitization';
Expand All @@ -33,18 +33,18 @@ describe('instructions', () => {
ɵɵelement(0, 'script');
}

describe('ɵɵselect', () => {
describe('ɵɵadvance', () => {
it('should error in DevMode if index is out of range', () => {
// Only one constant added, meaning only index `0` is valid.
const t = new TemplateFixture(createDiv, () => {}, 1, 0);
expect(() => {
t.update(() => {
ɵɵselect(-1);
ɵɵadvance(-1);
});
}).toThrow();
expect(() => {
t.update(() => {
ɵɵselect(1);
ɵɵadvance(1);
});
}).toThrow();
});
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('instructions', () => {
}
if (rf & RenderFlags.Update) {
const row_r2 = ctx0.$implicit;
ɵɵselect(1);
ɵɵadvance(1);
ɵɵproperty('ngForOf', row_r2);
}
}
Expand All @@ -239,7 +239,7 @@ describe('instructions', () => {
}
if (rf & RenderFlags.Update) {
const col_r3 = ctx1.$implicit;
ɵɵselect(1);
ɵɵadvance(1);
ɵɵtextInterpolate1('', col_r3, '');
}
}
Expand Down

0 comments on commit ee432aa

Please sign in to comment.