refactor(abstract): Use abstract keyword where possible to decrease file size. (#14112)
PR Close: #14112
This commit is contained in:

committed by
Miško Hevery

parent
bc47a8cc74
commit
14e97516cb
@ -8,7 +8,6 @@
|
||||
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detection';
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/errors';
|
||||
import {Type} from '../type';
|
||||
|
||||
import {ElementRef} from './element_ref';
|
||||
@ -30,32 +29,32 @@ export abstract class ComponentRef<C> {
|
||||
/**
|
||||
* Location of the Host Element of this Component Instance.
|
||||
*/
|
||||
get location(): ElementRef { return unimplemented(); }
|
||||
abstract get location(): ElementRef;
|
||||
|
||||
/**
|
||||
* The injector on which the component instance exists.
|
||||
*/
|
||||
get injector(): Injector { return unimplemented(); }
|
||||
abstract get injector(): Injector;
|
||||
|
||||
/**
|
||||
* The instance of the Component.
|
||||
*/
|
||||
get instance(): C { return unimplemented(); };
|
||||
abstract get instance(): C;
|
||||
|
||||
/**
|
||||
* The {@link ViewRef} of the Host View of this Component instance.
|
||||
*/
|
||||
get hostView(): ViewRef { return unimplemented(); };
|
||||
abstract get hostView(): ViewRef;
|
||||
|
||||
/**
|
||||
* The {@link ChangeDetectorRef} of the Component instance.
|
||||
*/
|
||||
get changeDetectorRef(): ChangeDetectorRef { return unimplemented(); }
|
||||
abstract get changeDetectorRef(): ChangeDetectorRef;
|
||||
|
||||
/**
|
||||
* The component type.
|
||||
*/
|
||||
get componentType(): Type<any> { return unimplemented(); }
|
||||
abstract get componentType(): Type<any>;
|
||||
|
||||
/**
|
||||
* Destroys the component instance and all of the data structures associated with it.
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import {Injector, THROW_IF_NOT_FOUND} from '../di/injector';
|
||||
import {unimplemented} from '../facade/errors';
|
||||
import {stringify} from '../facade/lang';
|
||||
import {Type} from '../type';
|
||||
import {ComponentFactory} from './component_factory';
|
||||
@ -27,18 +26,18 @@ export abstract class NgModuleRef<T> {
|
||||
/**
|
||||
* The injector that contains all of the providers of the NgModule.
|
||||
*/
|
||||
get injector(): Injector { return unimplemented(); }
|
||||
abstract get injector(): Injector;
|
||||
|
||||
/**
|
||||
* The ComponentFactoryResolver to get hold of the ComponentFactories
|
||||
* declared in the `entryComponents` property of the module.
|
||||
*/
|
||||
get componentFactoryResolver(): ComponentFactoryResolver { return unimplemented(); }
|
||||
abstract get componentFactoryResolver(): ComponentFactoryResolver;
|
||||
|
||||
/**
|
||||
* The NgModule instance.
|
||||
*/
|
||||
get instance(): T { return unimplemented(); }
|
||||
abstract get instance(): T;
|
||||
|
||||
/**
|
||||
* Destroys the module instance and all of the data structures associated with it.
|
||||
|
@ -37,7 +37,7 @@ export abstract class TemplateRef<C> {
|
||||
*
|
||||
*/
|
||||
// TODO(i): rename to anchor or location
|
||||
get elementRef(): ElementRef { return null; }
|
||||
abstract get elementRef(): ElementRef;
|
||||
|
||||
abstract createEmbeddedView(context: C): EmbeddedViewRef<C>;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import {Injector} from '../di/injector';
|
||||
import {unimplemented} from '../facade/errors';
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {WtfScopeFn, wtfCreateScope, wtfLeave} from '../profile/profile';
|
||||
|
||||
@ -42,11 +41,11 @@ export abstract class ViewContainerRef {
|
||||
* Anchor element that specifies the location of this container in the containing View.
|
||||
* <!-- TODO: rename to anchorElement -->
|
||||
*/
|
||||
get element(): ElementRef { return <ElementRef>unimplemented(); }
|
||||
abstract get element(): ElementRef;
|
||||
|
||||
get injector(): Injector { return <Injector>unimplemented(); }
|
||||
abstract get injector(): Injector;
|
||||
|
||||
get parentInjector(): Injector { return <Injector>unimplemented(); }
|
||||
abstract get parentInjector(): Injector;
|
||||
|
||||
/**
|
||||
* Destroys all Views in this container.
|
||||
@ -61,7 +60,7 @@ export abstract class ViewContainerRef {
|
||||
/**
|
||||
* Returns the number of Views currently attached to this container.
|
||||
*/
|
||||
get length(): number { return <number>unimplemented(); };
|
||||
abstract get length(): number;
|
||||
|
||||
/**
|
||||
* Instantiates an Embedded View based on the {@link TemplateRef `templateRef`} and inserts it
|
||||
|
@ -9,7 +9,6 @@
|
||||
import {AnimationQueue} from '../animation/animation_queue';
|
||||
import {ChangeDetectorRef} from '../change_detection/change_detector_ref';
|
||||
import {ChangeDetectorStatus} from '../change_detection/constants';
|
||||
import {unimplemented} from '../facade/errors';
|
||||
import {AppView} from './view';
|
||||
|
||||
/**
|
||||
@ -21,7 +20,7 @@ export abstract class ViewRef extends ChangeDetectorRef {
|
||||
*/
|
||||
abstract destroy(): void;
|
||||
|
||||
get destroyed(): boolean { return <boolean>unimplemented(); }
|
||||
abstract get destroyed(): boolean;
|
||||
|
||||
abstract onDestroy(callback: Function): any /** TODO #9100 */;
|
||||
}
|
||||
@ -81,9 +80,9 @@ export abstract class ViewRef extends ChangeDetectorRef {
|
||||
* @experimental
|
||||
*/
|
||||
export abstract class EmbeddedViewRef<C> extends ViewRef {
|
||||
get context(): C { return unimplemented(); }
|
||||
abstract get context(): C;
|
||||
|
||||
get rootNodes(): any[] { return <any[]>unimplemented(); };
|
||||
abstract get rootNodes(): any[];
|
||||
}
|
||||
|
||||
export class ViewRef_<C> implements EmbeddedViewRef<C>, ChangeDetectorRef {
|
||||
|
Reference in New Issue
Block a user