From ebf2270e4cf966a739239b6fbd229b68d12499c1 Mon Sep 17 00:00:00 2001 From: vsavkin Date: Mon, 29 Feb 2016 14:51:20 -0800 Subject: [PATCH] fix(transformers): record reflection info about abstract classes --- .../src/core/change_detection/change_detector_ref.ts | 2 -- modules/angular2/src/core/linker/element_ref.ts | 2 -- modules/angular2/src/core/linker/template_ref.ts | 2 -- modules/angular2/src/core/linker/view_container_ref.ts | 1 - modules/angular2/src/core/render/api.ts | 1 - .../transform/common/code/reflection_info_code.dart | 1 - .../directive_processor/abstract_classes/classes.dart | 10 ++++++++++ .../test/transform/directive_processor/all_tests.dart | 8 ++++++++ 8 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 modules_dart/transform/test/transform/directive_processor/abstract_classes/classes.dart diff --git a/modules/angular2/src/core/change_detection/change_detector_ref.ts b/modules/angular2/src/core/change_detection/change_detector_ref.ts index 86c31955120f9..e34fe448571b9 100644 --- a/modules/angular2/src/core/change_detection/change_detector_ref.ts +++ b/modules/angular2/src/core/change_detection/change_detector_ref.ts @@ -1,8 +1,6 @@ import {ChangeDetector} from './interfaces'; import {ChangeDetectionStrategy} from './constants'; -import {Injectable} from 'angular2/src/core/di'; -@Injectable() export abstract class ChangeDetectorRef { /** * Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked. diff --git a/modules/angular2/src/core/linker/element_ref.ts b/modules/angular2/src/core/linker/element_ref.ts index ceef37ec0f2a8..a052fb8fa04c3 100644 --- a/modules/angular2/src/core/linker/element_ref.ts +++ b/modules/angular2/src/core/linker/element_ref.ts @@ -1,5 +1,4 @@ import {unimplemented} from 'angular2/src/facade/exceptions'; -import {Injectable} from 'angular2/src/core/di'; import {AppElement} from './element'; /** @@ -12,7 +11,6 @@ import {AppElement} from './element'; * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM * element. */ -@Injectable() export abstract class ElementRef { /** * The underlying native element or `null` if direct access to native elements is not supported diff --git a/modules/angular2/src/core/linker/template_ref.ts b/modules/angular2/src/core/linker/template_ref.ts index b22b603ff5701..ad934be9a1ed5 100644 --- a/modules/angular2/src/core/linker/template_ref.ts +++ b/modules/angular2/src/core/linker/template_ref.ts @@ -1,5 +1,4 @@ import {ElementRef, ElementRef_} from './element_ref'; -import {Injectable} from 'angular2/src/core/di'; /** * Represents an Embedded Template that can be used to instantiate Embedded Views. @@ -13,7 +12,6 @@ import {Injectable} from 'angular2/src/core/di'; * {@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the * View Container. */ -@Injectable() export abstract class TemplateRef { /** * The location in the View where the Embedded View logically belongs to. diff --git a/modules/angular2/src/core/linker/view_container_ref.ts b/modules/angular2/src/core/linker/view_container_ref.ts index 8b1c2b827c765..3048c8a6f0731 100644 --- a/modules/angular2/src/core/linker/view_container_ref.ts +++ b/modules/angular2/src/core/linker/view_container_ref.ts @@ -36,7 +36,6 @@ import { * * */ -@Injectable() export abstract class ViewContainerRef { /** * Anchor element that specifies the location of this container in the containing View. diff --git a/modules/angular2/src/core/render/api.ts b/modules/angular2/src/core/render/api.ts index 37de28fca2393..95b89a2be19e7 100644 --- a/modules/angular2/src/core/render/api.ts +++ b/modules/angular2/src/core/render/api.ts @@ -13,7 +13,6 @@ export class RenderDebugInfo { export interface ParentRenderer { renderComponent(componentType: RenderComponentType): Renderer; } -@Injectable() export abstract class Renderer implements ParentRenderer { abstract renderComponent(componentType: RenderComponentType): Renderer; diff --git a/modules_dart/transform/lib/src/transform/common/code/reflection_info_code.dart b/modules_dart/transform/lib/src/transform/common/code/reflection_info_code.dart index c80316d8fef9e..e43f0cae4db31 100644 --- a/modules_dart/transform/lib/src/transform/common/code/reflection_info_code.dart +++ b/modules_dart/transform/lib/src/transform/common/code/reflection_info_code.dart @@ -67,7 +67,6 @@ class ReflectionInfoVisitor extends RecursiveAstVisitor { @override ReflectionInfoModel visitClassDeclaration(ClassDeclaration node) { - if (node.isAbstract) return null; if (!node.metadata .any((a) => _annotationMatcher.hasMatch(a.name, assetId))) { return null; diff --git a/modules_dart/transform/test/transform/directive_processor/abstract_classes/classes.dart b/modules_dart/transform/test/transform/directive_processor/abstract_classes/classes.dart new file mode 100644 index 0000000000000..71f61b5055f97 --- /dev/null +++ b/modules_dart/transform/test/transform/directive_processor/abstract_classes/classes.dart @@ -0,0 +1,10 @@ +library angular2.test.transform.directive_processor.abstract_classes.classes; + +import 'package:angular2/angular2.dart' show Injectable; + +@Injectable() +abstract class Service { + factory Service(){ + return null; + } +} \ No newline at end of file diff --git a/modules_dart/transform/test/transform/directive_processor/all_tests.dart b/modules_dart/transform/test/transform/directive_processor/all_tests.dart index 86a4a8b58a159..60e405a8167db 100644 --- a/modules_dart/transform/test/transform/directive_processor/all_tests.dart +++ b/modules_dart/transform/test/transform/directive_processor/all_tests.dart @@ -280,6 +280,14 @@ void allTests() { }); }); + it('should record information about abstract classes', + () async { + var model = (await _testCreateModel( + 'abstract_classes/classes.dart')).ngDeps; + + expect(model.reflectables.first.name).toEqual("Service"); + }); + it('should not throw/hang on invalid urls', () async { var logger = new RecordingLogger(); await _testCreateModel('invalid_url_files/hello.dart', logger: logger);