Skip to content

Commit

Permalink
fix(dart/reflection): Fix NoReflectionCapabilities interface
Browse files Browse the repository at this point in the history
Make `NoReflectionCapabilities` conform to the `PlatformReflectionCapbilities`
api, which prevents some confusing error messages.

Closes #5559

Closes #5578
  • Loading branch information
Tim Blasi authored and kegluneq committed Dec 3, 2015
1 parent 680f7e0 commit 0a3a17f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 13 additions & 5 deletions modules/angular2/src/core/reflection/reflection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,53 @@ import 'platform_reflection_capabilities.dart';
import 'package:angular2/src/facade/lang.dart';

class NoReflectionCapabilities implements PlatformReflectionCapabilities {
@override
bool isReflectionEnabled() {
return false;
}

@override
Function factory(Type type) {
throw "Cannot find reflection information on ${stringify(type)}";
}

@override
List interfaces(Type type) {
throw "Cannot find reflection information on ${stringify(type)}";
}

List parameters(Type type) {
@override
List parameters(dynamic type) {
throw "Cannot find reflection information on ${stringify(type)}";
}

List annotations(Type type) {
@override
List annotations(dynamic type) {
throw "Cannot find reflection information on ${stringify(type)}";
}

Map propMetadata(Type type) {
@override
Map propMetadata(dynamic type) {
throw "Cannot find reflection information on ${stringify(type)}";
}

@override
GetterFn getter(String name) {
throw "Cannot find getter ${name}";
}

@override
SetterFn setter(String name) {
throw "Cannot find setter ${name}";
}

@override
MethodFn method(String name) {
throw "Cannot find method ${name}";
}

@override
String importUri(Type type) => './';

String moduleId(Type type) => './';
}

final Reflector reflector = new Reflector(new NoReflectionCapabilities());
1 change: 0 additions & 1 deletion modules/angular2/test/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,6 @@ var NG_ALL = [
"NoReflectionCapabilities.interfaces():dart",
"NoReflectionCapabilities.isReflectionEnabled():dart",
"NoReflectionCapabilities.method():dart",
"NoReflectionCapabilities.moduleId():dart",
"NoReflectionCapabilities.parameters():dart",
"NoReflectionCapabilities.propMetadata():dart",
"NoReflectionCapabilities.setter():dart",
Expand Down

0 comments on commit 0a3a17f

Please sign in to comment.