refactor(upgrade): remove unused parameters/properties/variables (#39965)

This commit removes some unused parameters, properties and variables in
various `@angular/upgrade` functions.

PR Close #39965
This commit is contained in:
George Kalpakas 2020-12-07 19:55:34 +02:00 committed by Misko Hevery
parent e69288418c
commit 988b1e3506
4 changed files with 8 additions and 11 deletions

View File

@ -174,8 +174,8 @@ export function downgradeComponent(info: {
const injectorPromise = new ParentInjectorPromise(element); const injectorPromise = new ParentInjectorPromise(element);
const facade = new DowngradeComponentAdapter( const facade = new DowngradeComponentAdapter(
element, attrs, scope, ngModel, injector, $injector, $compile, $parse, element, attrs, scope, ngModel, injector, $compile, $parse, componentFactory,
componentFactory, wrapCallback); wrapCallback);
const projectableNodes = facade.compileContents(); const projectableNodes = facade.compileContents();
facade.createComponent(projectableNodes); facade.createComponent(projectableNodes);

View File

@ -8,7 +8,7 @@
import {ApplicationRef, ChangeDetectorRef, ComponentFactory, ComponentRef, EventEmitter, Injector, OnChanges, SimpleChange, SimpleChanges, StaticProvider, Testability, TestabilityRegistry, Type} from '@angular/core'; import {ApplicationRef, ChangeDetectorRef, ComponentFactory, ComponentRef, EventEmitter, Injector, OnChanges, SimpleChange, SimpleChanges, StaticProvider, Testability, TestabilityRegistry, Type} from '@angular/core';
import {IAttributes, IAugmentedJQuery, ICompileService, IInjectorService, INgModelController, IParseService, IScope} from './angular1'; import {IAttributes, IAugmentedJQuery, ICompileService, INgModelController, IParseService, IScope} from './angular1';
import {PropertyBinding} from './component_info'; import {PropertyBinding} from './component_info';
import {$SCOPE} from './constants'; import {$SCOPE} from './constants';
import {getTypeName, hookupNgModel, strictEquals} from './util'; import {getTypeName, hookupNgModel, strictEquals} from './util';
@ -33,8 +33,8 @@ export class DowngradeComponentAdapter {
constructor( constructor(
private element: IAugmentedJQuery, private attrs: IAttributes, private scope: IScope, private element: IAugmentedJQuery, private attrs: IAttributes, private scope: IScope,
private ngModel: INgModelController, private parentInjector: Injector, private ngModel: INgModelController, private parentInjector: Injector,
private $injector: IInjectorService, private $compile: ICompileService, private $compile: ICompileService, private $parse: IParseService,
private $parse: IParseService, private componentFactory: ComponentFactory<any>, private componentFactory: ComponentFactory<any>,
private wrapCallback: <T>(cb: () => T) => () => T) { private wrapCallback: <T>(cb: () => T) => () => T) {
this.componentScope = scope.$new(); this.componentScope = scope.$new();
} }
@ -250,7 +250,6 @@ export class DowngradeComponentAdapter {
*/ */
export function groupNodesBySelector(ngContentSelectors: string[], nodes: Node[]): Node[][] { export function groupNodesBySelector(ngContentSelectors: string[], nodes: Node[]): Node[][] {
const projectableNodes: Node[][] = []; const projectableNodes: Node[][] = [];
let wildcardNgContentIndex: number;
for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) { for (let i = 0, ii = ngContentSelectors.length; i < ii; ++i) {
projectableNodes[i] = []; projectableNodes[i] = [];

View File

@ -41,8 +41,7 @@ export class UpgradeHelper {
private readonly $controller: IControllerService; private readonly $controller: IControllerService;
constructor( constructor(
private injector: Injector, private name: string, elementRef: ElementRef, injector: Injector, private name: string, elementRef: ElementRef, directive?: IDirective) {
directive?: IDirective) {
this.$injector = injector.get($INJECTOR); this.$injector = injector.get($INJECTOR);
this.$compile = this.$injector.get($COMPILE); this.$compile = this.$injector.get($COMPILE);
this.$controller = this.$injector.get($CONTROLLER); this.$controller = this.$injector.get($CONTROLLER);

View File

@ -131,7 +131,6 @@ withEachNg1Version(() => {
let scope: angular.IScope; // mock let scope: angular.IScope; // mock
let ngModel = undefined as any; let ngModel = undefined as any;
let parentInjector: Injector; // testbed let parentInjector: Injector; // testbed
let $injector = undefined as any;
let $compile = undefined as any; let $compile = undefined as any;
let $parse = undefined as any; let $parse = undefined as any;
let componentFactory: ComponentFactory<any>; // testbed let componentFactory: ComponentFactory<any>; // testbed
@ -166,8 +165,8 @@ withEachNg1Version(() => {
parentInjector = TestBed; parentInjector = TestBed;
return new DowngradeComponentAdapter( return new DowngradeComponentAdapter(
element, attrs, scope, ngModel, parentInjector, $injector, $compile, $parse, element, attrs, scope, ngModel, parentInjector, $compile, $parse, componentFactory,
componentFactory, wrapCallback); wrapCallback);
} }
beforeEach(() => { beforeEach(() => {