X Tutup
Skip to content

Commit 05c185a

Browse files
committed
fix(transformers): record reflection info about abstract classes
Closes angular#7347
1 parent b47f80e commit 05c185a

File tree

8 files changed

+18
-9
lines changed

8 files changed

+18
-9
lines changed

modules/angular2/src/core/change_detection/change_detector_ref.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {ChangeDetector} from './interfaces';
22
import {ChangeDetectionStrategy} from './constants';
3-
import {Injectable} from 'angular2/src/core/di';
43

5-
@Injectable()
64
export abstract class ChangeDetectorRef {
75
/**
86
* Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.

modules/angular2/src/core/linker/element_ref.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {unimplemented} from 'angular2/src/facade/exceptions';
2-
import {Injectable} from 'angular2/src/core/di';
32
import {AppElement} from './element';
43

54
/**
@@ -12,7 +11,6 @@ import {AppElement} from './element';
1211
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
1312
* element.
1413
*/
15-
@Injectable()
1614
export abstract class ElementRef {
1715
/**
1816
* The underlying native element or `null` if direct access to native elements is not supported

modules/angular2/src/core/linker/template_ref.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {ElementRef, ElementRef_} from './element_ref';
2-
import {Injectable} from 'angular2/src/core/di';
32

43
/**
54
* Represents an Embedded Template that can be used to instantiate Embedded Views.
@@ -13,7 +12,6 @@ import {Injectable} from 'angular2/src/core/di';
1312
* {@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
1413
* View Container.
1514
*/
16-
@Injectable()
1715
export abstract class TemplateRef {
1816
/**
1917
* The location in the View where the Embedded View logically belongs to.

modules/angular2/src/core/linker/view_container_ref.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
*
3737
* <!-- TODO(i): we are also considering ElementRef#viewContainer api -->
3838
*/
39-
@Injectable()
4039
export abstract class ViewContainerRef {
4140
/**
4241
* Anchor element that specifies the location of this container in the containing View.

modules/angular2/src/core/render/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export class RenderDebugInfo {
1313

1414
export interface ParentRenderer { renderComponent(componentType: RenderComponentType): Renderer; }
1515

16-
@Injectable()
1716
export abstract class Renderer implements ParentRenderer {
1817
abstract renderComponent(componentType: RenderComponentType): Renderer;
1918

modules_dart/transform/lib/src/transform/common/code/reflection_info_code.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class ReflectionInfoVisitor extends RecursiveAstVisitor<ReflectionInfoModel> {
6767

6868
@override
6969
ReflectionInfoModel visitClassDeclaration(ClassDeclaration node) {
70-
if (node.isAbstract) return null;
7170
if (!node.metadata
7271
.any((a) => _annotationMatcher.hasMatch(a.name, assetId))) {
7372
return null;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
library angular2.test.transform.directive_processor.abstract_classes.classes;
2+
3+
import 'package:angular2/angular2.dart' show Injectable;
4+
5+
@Injectable()
6+
abstract class Service {
7+
factory Service(){
8+
return null;
9+
}
10+
}

modules_dart/transform/test/transform/directive_processor/all_tests.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,14 @@ void allTests() {
280280
});
281281
});
282282

283+
it('should record information about abstract classes',
284+
() async {
285+
var model = (await _testCreateModel(
286+
'abstract_classes/classes.dart')).ngDeps;
287+
288+
expect(model.reflectables.first.name).toEqual("Service");
289+
});
290+
283291
it('should not throw/hang on invalid urls', () async {
284292
var logger = new RecordingLogger();
285293
await _testCreateModel('invalid_url_files/hello.dart', logger: logger);

0 commit comments

Comments
 (0)
X Tutup