Revert "refactor(core): Removed readonly getters and changed to readonly (#19225)"

This reverts commit 2b84b86fc0.
This commit is contained in:
Victor Berchet
2017-09-28 13:36:44 -07:00
parent bed8ac70f7
commit 6a9ce67714
14 changed files with 46 additions and 64 deletions

View File

@ -27,11 +27,7 @@ import {resolveForwardRef} from './forward_ref';
* @deprecated No replacement
*/
export class ReflectiveKey {
/**
* Returns a stringified token.
*/
readonly displayName: string;
public readonly displayName: string;
/**
* Private
*/

View File

@ -71,13 +71,11 @@ export interface ResolvedReflectiveProvider {
}
export class ResolvedReflectiveProvider_ implements ResolvedReflectiveProvider {
readonly resolvedFactory: ResolvedReflectiveFactory;
constructor(
public key: ReflectiveKey, public resolvedFactories: ResolvedReflectiveFactory[],
public multiProvider: boolean) {
this.resolvedFactory = this.resolvedFactories[0];
}
public multiProvider: boolean) {}
get resolvedFactory(): ResolvedReflectiveFactory { return this.resolvedFactories[0]; }
}
/**

View File

@ -66,20 +66,13 @@ export class CodegenComponentFactoryResolver implements ComponentFactoryResolver
}
export class ComponentFactoryBoundToModule<C> extends ComponentFactory<C> {
readonly selector: string;
readonly componentType: Type<any>;
readonly ngContentSelectors: string[];
readonly inputs: {propName: string, templateName: string}[];
readonly outputs: {propName: string, templateName: string}[];
constructor(private factory: ComponentFactory<C>, private ngModule: NgModuleRef<any>) { super(); }
constructor(private factory: ComponentFactory<C>, private ngModule: NgModuleRef<any>) {
super();
this.selector = factory.selector;
this.componentType = factory.componentType;
this.ngContentSelectors = factory.ngContentSelectors;
this.inputs = factory.inputs;
this.outputs = factory.outputs;
}
get selector() { return this.factory.selector; }
get componentType() { return this.factory.componentType; }
get ngContentSelectors() { return this.factory.ngContentSelectors; }
get inputs() { return this.factory.inputs; }
get outputs() { return this.factory.outputs; }
create(
injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any,

View File

@ -41,9 +41,9 @@ export class QueryList<T>/* implements Iterable<T> */ {
private _results: Array<T> = [];
public readonly changes: Observable<any> = new EventEmitter();
readonly length: number;
readonly first: T;
readonly last: T;
get length(): number { return this._results.length; }
get first(): T { return this._results[0]; }
get last(): T { return this._results[this.length - 1]; }
/**
* See
@ -98,9 +98,6 @@ export class QueryList<T>/* implements Iterable<T> */ {
reset(res: Array<T|any[]>): void {
this._results = flatten(res);
(this as{dirty: boolean}).dirty = false;
(this as{length: number}).length = this._results.length;
(this as{last: T}).last = this._results[this.length - 1];
(this as{first: T}).first = this._results[0];
}
notifyOnChanges(): void { (this.changes as EventEmitter<any>).emit(this); }

View File

@ -478,8 +478,6 @@ class NgModuleRef_ implements NgModuleData, InternalNgModuleRef<any> {
/** @internal */
_providers: any[];
readonly injector: Injector = this;
constructor(
private _moduleType: Type<any>, public _parent: Injector,
public _bootstrapComponents: Type<any>[], public _def: NgModuleDefinition) {
@ -495,6 +493,8 @@ class NgModuleRef_ implements NgModuleData, InternalNgModuleRef<any> {
get componentFactoryResolver() { return this.get(ComponentFactoryResolver); }
get injector(): Injector { return this; }
destroy(): void {
if (this._destroyed) {
throw new Error(

View File

@ -618,8 +618,9 @@ class DebugRendererFactory2 implements RendererFactory2 {
class DebugRenderer2 implements Renderer2 {
readonly data: {[key: string]: any};
constructor(private delegate: Renderer2) { this.data = this.delegate.data; }
constructor(private delegate: Renderer2) {}
get data() { return this.delegate.data; }
destroyNode(node: any) {
removeDebugNodeFromIndex(getDebugNode(node) !);