diff --git a/modules/angular2/src/core/di/binding.ts b/modules/angular2/src/core/di/binding.ts index 4791fea70a..b2fc456a62 100644 --- a/modules/angular2/src/core/di/binding.ts +++ b/modules/angular2/src/core/di/binding.ts @@ -255,30 +255,26 @@ export class Binding { * expect(injector.get('message')).toEqual('Hello'); * ``` */ -export abstract class ResolvedBinding { +export interface ResolvedBinding { /** * A key, usually a `Type`. */ - public key: Key; + key: Key; /** * Factory function which can return an instance of an object represented by a key. */ - public resolvedFactories: ResolvedFactory[]; + resolvedFactories: ResolvedFactory[]; /** * Indicates if the binding is a multi-binding or a regular binding. */ - public multiBinding: boolean; + multiBinding: boolean; } -export class ResolvedBinding_ extends ResolvedBinding { - constructor(key: Key, resolvedFactories: ResolvedFactory[], multiBinding: boolean) { - super(); - this.key = key; - this.resolvedFactories = resolvedFactories; - this.multiBinding = multiBinding; - } +export class ResolvedBinding_ implements ResolvedBinding { + constructor(public key: Key, public resolvedFactories: ResolvedFactory[], + public multiBinding: boolean) {} get resolvedFactory(): ResolvedFactory { return this.resolvedFactories[0]; } } diff --git a/modules/angular2/src/core/di/exceptions.ts b/modules/angular2/src/core/di/exceptions.ts index c7f8a9017b..e67fe218e6 100644 --- a/modules/angular2/src/core/di/exceptions.ts +++ b/modules/angular2/src/core/di/exceptions.ts @@ -134,17 +134,7 @@ export class CyclicDependencyError extends AbstractBindingError { * } * ``` */ -export abstract class InstantiationError extends WrappedException { - constructor(message, originalException, originalStack, context) { - super(message, originalException, originalStack, context); - } - abstract addKey(injector: Injector, key: Key): void; - get wrapperMessage(): string { return unimplemented(); }; - get causeKey(): Key { return unimplemented(); }; - get context() { return unimplemented(); }; -} - -export class InstantiationError_ extends InstantiationError { +export class InstantiationError extends WrappedException { /** @internal */ keys: Key[]; diff --git a/modules/angular2/src/core/di/injector.ts b/modules/angular2/src/core/di/injector.ts index d161425398..1f7cc1596f 100644 --- a/modules/angular2/src/core/di/injector.ts +++ b/modules/angular2/src/core/di/injector.ts @@ -13,7 +13,6 @@ import { NoBindingError, CyclicDependencyError, InstantiationError, - InstantiationError_, InvalidBindingError, OutOfBoundsError, MixingMultiBindingsWithRegularBindings @@ -866,7 +865,7 @@ export class Injector { break; } } catch (e) { - throw new InstantiationError_(this, e, e.stack, binding.key); + throw new InstantiationError(this, e, e.stack, binding.key); } return obj; } diff --git a/modules/angular2/src/core/directives/ng_class.ts b/modules/angular2/src/core/directives/ng_class.ts index 97b4d59076..1276ac47f7 100644 --- a/modules/angular2/src/core/directives/ng_class.ts +++ b/modules/angular2/src/core/directives/ng_class.ts @@ -2,7 +2,6 @@ import {isPresent, isString, StringWrapper, isBlank} from 'angular2/src/core/fac import {DoCheck, OnDestroy} from 'angular2/lifecycle_hooks'; import {Directive} from 'angular2/src/core/metadata'; import {ElementRef} from 'angular2/src/core/linker'; -import {ElementRef_} from '../linker/element_ref'; import { IterableDiffer, IterableDiffers, diff --git a/modules/angular2/src/core/directives/ng_style.ts b/modules/angular2/src/core/directives/ng_style.ts index 0e21971963..fbeebd8b3e 100644 --- a/modules/angular2/src/core/directives/ng_style.ts +++ b/modules/angular2/src/core/directives/ng_style.ts @@ -7,7 +7,6 @@ import {ElementRef} from 'angular2/src/core/linker'; import {Directive} from 'angular2/src/core/metadata'; import {Renderer} from 'angular2/src/core/render'; import {isPresent, isBlank, print} from 'angular2/src/core/facade/lang'; -import {ElementRef_} from "../linker/element_ref"; /** * The `NgStyle` directive changes styles based on a result of expression evaluation. diff --git a/modules/angular2/src/core/linker/dynamic_component_loader.ts b/modules/angular2/src/core/linker/dynamic_component_loader.ts index 9e2a535e57..dde6be616c 100644 --- a/modules/angular2/src/core/linker/dynamic_component_loader.ts +++ b/modules/angular2/src/core/linker/dynamic_component_loader.ts @@ -14,6 +14,14 @@ import {ViewRef, HostViewRef} from './view_ref'; * method. */ export abstract class ComponentRef { + /** + * The injector provided {@link DynamicComponentLoader#loadAsRoot}. + * + * TODO(i): this api is useless and should be replaced by an injector retrieved from + * the HostElementRef, which is currently not possible. + */ + injector: Injector; + /** * Location of the Host Element of this Component Instance. */ @@ -54,14 +62,6 @@ export abstract class ComponentRef { } export class ComponentRef_ extends ComponentRef { - /** - * The injector provided {@link DynamicComponentLoader#loadAsRoot}. - * - * TODO(i): this api is useless and should be replaced by an injector retrieved from - * the HostElementRef, which is currently not possible. - */ - injector: Injector; - /** * TODO(i): refactor into public/private fields */ diff --git a/modules/angular2/src/core/metadata/view.ts b/modules/angular2/src/core/metadata/view.ts index 63e51d1eb0..c3e44bcbb6 100644 --- a/modules/angular2/src/core/metadata/view.ts +++ b/modules/angular2/src/core/metadata/view.ts @@ -115,7 +115,7 @@ export class ViewMetadata { * } * ``` */ - directives: Array; + directives: Array; pipes: Array; diff --git a/modules/angular2/src/core/render/api.ts b/modules/angular2/src/core/render/api.ts index f5935a8dfb..94e6d60c24 100644 --- a/modules/angular2/src/core/render/api.ts +++ b/modules/angular2/src/core/render/api.ts @@ -13,12 +13,7 @@ import {Map} from 'angular2/src/core/facade/collection'; * * */ -export abstract class RenderProtoViewRef {} - -export class RenderProtoViewRef_ extends RenderProtoViewRef { - constructor() { super(); } -} - +export class RenderProtoViewRef {} /** * Represents a list of sibling Nodes that can be moved by the {@link Renderer} independently of diff --git a/modules/angular2/src/router/path_recognizer.ts b/modules/angular2/src/router/path_recognizer.ts index 1c5711cdbe..7a167490b8 100644 --- a/modules/angular2/src/router/path_recognizer.ts +++ b/modules/angular2/src/router/path_recognizer.ts @@ -12,7 +12,7 @@ import {Map, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collec import {RouteHandler} from './route_handler'; import {Url, RootUrl, serializeParams} from './url_parser'; -import {ComponentInstruction, ComponentInstruction_} from "./instruction"; +import {ComponentInstruction, ComponentInstruction_} from './instruction'; class TouchMap { map: {[key: string]: string} = {}; diff --git a/modules/angular2/src/router/router_outlet.ts b/modules/angular2/src/router/router_outlet.ts index c1f129f3d7..2428372f83 100644 --- a/modules/angular2/src/router/router_outlet.ts +++ b/modules/angular2/src/router/router_outlet.ts @@ -1,6 +1,6 @@ import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async'; import {StringMapWrapper} from 'angular2/src/core/facade/collection'; -import {isBlank, isPresent, Type} from 'angular2/src/core/facade/lang'; +import {isBlank, isPresent} from 'angular2/src/core/facade/lang'; import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions'; import {Directive, Attribute} from 'angular2/src/core/metadata'; diff --git a/modules/angular2/src/test_lib/test_injector.ts b/modules/angular2/src/test_lib/test_injector.ts index d752b46ab7..4afb5797ed 100644 --- a/modules/angular2/src/test_lib/test_injector.ts +++ b/modules/angular2/src/test_lib/test_injector.ts @@ -57,9 +57,9 @@ import {APP_ID} from 'angular2/src/core/application_tokens'; import {Serializer} from "angular2/src/web_workers/shared/serializer"; import {Log} from './utils'; import {compilerBindings} from 'angular2/src/core/compiler/compiler'; -import {DomRenderer_} from "../core/render/dom/dom_renderer"; -import {DynamicComponentLoader_} from "../core/linker/dynamic_component_loader"; -import {AppViewManager_} from "../core/linker/view_manager"; +import {DomRenderer_} from "angular2/src/core/render/dom/dom_renderer"; +import {DynamicComponentLoader_} from "angular2/src/core/linker/dynamic_component_loader"; +import {AppViewManager_} from "angular2/src/core/linker/view_manager"; /** * Returns the root injector bindings. diff --git a/modules/angular2/test/core/di/injector_spec.ts b/modules/angular2/test/core/di/injector_spec.ts index f5904a2c5e..98fe764516 100644 --- a/modules/angular2/test/core/di/injector_spec.ts +++ b/modules/angular2/test/core/di/injector_spec.ts @@ -18,6 +18,7 @@ import { Binding } from 'angular2/core'; import {DependencyMetadata} from 'angular2/src/core/di/metadata'; +import {ResolvedBinding_} from 'angular2/src/core/di/binding'; import { InjectorInlineStrategy, @@ -577,7 +578,7 @@ export function main() { var bindings = Injector.resolve([Engine, [BrokenEngine]]); bindings.forEach(function(b) { if (isBlank(b)) return; // the result is a sparse array - expect(b instanceof ResolvedBinding).toBe(true); + expect(b instanceof ResolvedBinding_).toBe(true); }); }); diff --git a/modules/angular2/test/web_workers/shared/render_proto_view_ref_store_spec.ts b/modules/angular2/test/web_workers/shared/render_proto_view_ref_store_spec.ts index 8329432d3b..a518cb5a24 100644 --- a/modules/angular2/test/web_workers/shared/render_proto_view_ref_store_spec.ts +++ b/modules/angular2/test/web_workers/shared/render_proto_view_ref_store_spec.ts @@ -7,7 +7,7 @@ import { it, expect } from "angular2/test_lib"; -import {RenderProtoViewRef, RenderProtoViewRef_} from "angular2/src/core/render/api"; +import {RenderProtoViewRef} from "angular2/src/core/render/api"; import {RenderProtoViewRefStore} from "angular2/src/web_workers/shared/render_proto_view_ref_store"; import { WebWorkerRenderProtoViewRef @@ -36,14 +36,14 @@ export function main() { beforeEach(() => { store = new RenderProtoViewRefStore(false); }); it("should associate views with the correct references", () => { - var renderProtoViewRef = new RenderProtoViewRef_(); + var renderProtoViewRef = new RenderProtoViewRef(); store.store(renderProtoViewRef, 100); expect(store.deserialize(100)).toBe(renderProtoViewRef); }); it("should be serializable", () => { - var renderProtoViewRef = new RenderProtoViewRef_(); + var renderProtoViewRef = new RenderProtoViewRef(); store.store(renderProtoViewRef, 0); var deserialized = store.deserialize(store.serialize(renderProtoViewRef)); diff --git a/modules/benchmarks/src/costs/index.ts b/modules/benchmarks/src/costs/index.ts index 3a0664c790..e180962401 100644 --- a/modules/benchmarks/src/costs/index.ts +++ b/modules/benchmarks/src/costs/index.ts @@ -11,7 +11,7 @@ import { import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle'; import {ListWrapper} from 'angular2/src/core/facade/collection'; import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; -import {ComponentRef_} from "../../../angular2/src/core/linker/dynamic_component_loader"; +import {ComponentRef} from "angular2/src/core/linker/dynamic_component_loader"; var testList = null; @@ -21,7 +21,7 @@ export function main() { bootstrap(AppComponent) .then((ref) => { - var injector = (ref).injector; + var injector = ref.injector; var app: AppComponent = ref.hostComponent; var lifeCycle = injector.get(LifeCycle); diff --git a/modules/benchmarks/src/largetable/largetable_benchmark.ts b/modules/benchmarks/src/largetable/largetable_benchmark.ts index ac27b14d54..3e6aa278ea 100644 --- a/modules/benchmarks/src/largetable/largetable_benchmark.ts +++ b/modules/benchmarks/src/largetable/largetable_benchmark.ts @@ -26,7 +26,7 @@ import {ListWrapper} from 'angular2/src/core/facade/collection'; import {Inject} from 'angular2/src/core/di/decorators'; import {reflector} from 'angular2/src/core/reflection/reflection'; -import {ComponentRef_} from "../../../angular2/src/core/linker/dynamic_component_loader"; +import {ComponentRef} from "angular2/src/core/linker/dynamic_component_loader"; export const BENCHMARK_TYPE = 'LargetableComponent.benchmarkType'; export const LARGETABLE_ROWS = 'LargetableComponent.rows'; @@ -125,7 +125,7 @@ export function main() { function initNg2() { bootstrap(AppComponent, _createBindings()) .then((ref) => { - var injector = (ref).injector; + var injector = ref.injector; app = ref.hostComponent; lifecycle = injector.get(LifeCycle); bindAction('#ng2DestroyDom', ng2DestroyDom); diff --git a/modules/benchmarks/src/tree/tree_benchmark.ts b/modules/benchmarks/src/tree/tree_benchmark.ts index 6bf87f91a2..8a9346df66 100644 --- a/modules/benchmarks/src/tree/tree_benchmark.ts +++ b/modules/benchmarks/src/tree/tree_benchmark.ts @@ -23,7 +23,7 @@ import { } from 'angular2/src/test_lib/benchmark_util'; import {BrowserDomAdapter} from 'angular2/src/core/dom/browser_adapter'; import {APP_VIEW_POOL_CAPACITY} from 'angular2/src/core/linker/view_pool'; -import {ComponentRef_} from "../../../angular2/src/core/linker/dynamic_component_loader"; +import {ComponentRef} from "angular2/src/core/linker/dynamic_component_loader"; function createBindings(): Binding[] { var viewCacheCapacity = getStringParameter('viewcache') == 'true' ? 10000 : 1; @@ -94,7 +94,7 @@ export function main() { function initNg2() { bootstrap(AppComponent, createBindings()) .then((ref) => { - var injector = (ref).injector; + var injector = ref.injector; lifeCycle = injector.get(LifeCycle); app = ref.hostComponent; diff --git a/modules/upgrade/src/upgrade_module.ts b/modules/upgrade/src/upgrade_module.ts index ce44cc2c10..101216f0f1 100644 --- a/modules/upgrade/src/upgrade_module.ts +++ b/modules/upgrade/src/upgrade_module.ts @@ -34,7 +34,7 @@ import { } from './constants'; import {Ng2ComponentFacade} from './ng2_facade'; import {ExportedNg1Component} from './ng1_facade'; -import {NgZone_} from "../../angular2/src/core/zone/ng_zone"; +import {NgZone_} from "angular2/src/core/zone/ng_zone"; var moduleCount: number = 0;