Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transformers): record reflection info about abstract classes #7347

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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.
Expand Down
2 changes: 0 additions & 2 deletions 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';

/**
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions 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.
Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion modules/angular2/src/core/linker/view_container_ref.ts
Expand Up @@ -36,7 +36,6 @@ import {
*
* <!-- TODO(i): we are also considering ElementRef#viewContainer api -->
*/
@Injectable()
export abstract class ViewContainerRef {
/**
* Anchor element that specifies the location of this container in the containing View.
Expand Down
1 change: 0 additions & 1 deletion modules/angular2/src/core/render/api.ts
Expand Up @@ -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;

Expand Down
Expand Up @@ -67,7 +67,6 @@ class ReflectionInfoVisitor extends RecursiveAstVisitor<ReflectionInfoModel> {

@override
ReflectionInfoModel visitClassDeclaration(ClassDeclaration node) {
if (node.isAbstract) return null;
if (!node.metadata
.any((a) => _annotationMatcher.hasMatch(a.name, assetId))) {
return null;
Expand Down
@@ -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;
}
}
Expand Up @@ -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);
Expand Down