fix(transformers): record reflection info about abstract classes
Closes #7347
This commit is contained in:
parent
b47f80ec76
commit
05c185a7b1
|
@ -1,8 +1,6 @@
|
||||||
import {ChangeDetector} from './interfaces';
|
import {ChangeDetector} from './interfaces';
|
||||||
import {ChangeDetectionStrategy} from './constants';
|
import {ChangeDetectionStrategy} from './constants';
|
||||||
import {Injectable} from 'angular2/src/core/di';
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export abstract class ChangeDetectorRef {
|
export abstract class ChangeDetectorRef {
|
||||||
/**
|
/**
|
||||||
* Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
|
* Marks all {@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {unimplemented} from 'angular2/src/facade/exceptions';
|
import {unimplemented} from 'angular2/src/facade/exceptions';
|
||||||
import {Injectable} from 'angular2/src/core/di';
|
|
||||||
import {AppElement} from './element';
|
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
|
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
|
||||||
* element.
|
* element.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
|
||||||
export abstract class ElementRef {
|
export abstract class ElementRef {
|
||||||
/**
|
/**
|
||||||
* The underlying native element or `null` if direct access to native elements is not supported
|
* The underlying native element or `null` if direct access to native elements is not supported
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {ElementRef, ElementRef_} from './element_ref';
|
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.
|
* 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
|
* {@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
|
||||||
* View Container.
|
* View Container.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
|
||||||
export abstract class TemplateRef {
|
export abstract class TemplateRef {
|
||||||
/**
|
/**
|
||||||
* The location in the View where the Embedded View logically belongs to.
|
* The location in the View where the Embedded View logically belongs to.
|
||||||
|
|
|
@ -36,7 +36,6 @@ import {
|
||||||
*
|
*
|
||||||
* <!-- TODO(i): we are also considering ElementRef#viewContainer api -->
|
* <!-- TODO(i): we are also considering ElementRef#viewContainer api -->
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
|
||||||
export abstract class ViewContainerRef {
|
export abstract class ViewContainerRef {
|
||||||
/**
|
/**
|
||||||
* Anchor element that specifies the location of this container in the containing View.
|
* Anchor element that specifies the location of this container in the containing View.
|
||||||
|
|
|
@ -13,7 +13,6 @@ export class RenderDebugInfo {
|
||||||
|
|
||||||
export interface ParentRenderer { renderComponent(componentType: RenderComponentType): Renderer; }
|
export interface ParentRenderer { renderComponent(componentType: RenderComponentType): Renderer; }
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export abstract class Renderer implements ParentRenderer {
|
export abstract class Renderer implements ParentRenderer {
|
||||||
abstract renderComponent(componentType: RenderComponentType): Renderer;
|
abstract renderComponent(componentType: RenderComponentType): Renderer;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,6 @@ class ReflectionInfoVisitor extends RecursiveAstVisitor<ReflectionInfoModel> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ReflectionInfoModel visitClassDeclaration(ClassDeclaration node) {
|
ReflectionInfoModel visitClassDeclaration(ClassDeclaration node) {
|
||||||
if (node.isAbstract) return null;
|
|
||||||
if (!node.metadata
|
if (!node.metadata
|
||||||
.any((a) => _annotationMatcher.hasMatch(a.name, assetId))) {
|
.any((a) => _annotationMatcher.hasMatch(a.name, assetId))) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
it('should not throw/hang on invalid urls', () async {
|
||||||
var logger = new RecordingLogger();
|
var logger = new RecordingLogger();
|
||||||
await _testCreateModel('invalid_url_files/hello.dart', logger: logger);
|
await _testCreateModel('invalid_url_files/hello.dart', logger: logger);
|
||||||
|
|
Loading…
Reference in New Issue