Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Unified Diff: runtime/lib/mirrors_impl.dart

Issue 183853022: Hoist hasReflectedType and reflectedType from ClassMirror to TypeMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/mirrors_impl.dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 4efc47c57145a3dd56acb27d972f6398c2efcac1..283a59756c20a22e1b2fb02662f0986f88e6c2de 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -1054,7 +1054,9 @@ class _LocalTypeVariableMirror extends _LocalDeclarationMirror
}
bool get hasReflectedType => false;
- Type get reflectedType => throw new UnsupportedError();
+ Type get reflectedType {
+ throw new UnsupportedError('Type variables have no reflected type');
+ }
Type get _reflectedType => _reflectee;
List<TypeVariableMirror> get typeVariables => emptyList;
@@ -1131,6 +1133,15 @@ class _LocalTypedefMirror extends _LocalDeclarationMirror
return _referent;
}
+ bool get hasReflectedType => !_isGenericDeclaration;
+ Type get reflectedType {
+ if (!hasReflectedType) {
+ throw new UnsupportedError(
+ "Declarations of generics have no reflected type");
+ }
+ return _reflectedType;
+ }
+
bool get isOriginalDeclaration => !_isGeneric || _isGenericDeclaration;
TypedefMirror get originalDeclaration {
@@ -1538,6 +1549,12 @@ class _SpecialTypeMirror extends _LocalMirror
List<InstanceMirror> get metadata => emptyList;
+ bool get hasReflectedType => simpleName == #dynamic;
+ Type get reflectedType {
+ if (simpleName == #dynamic) return dynamic;
+ throw new UnsupportedError("void has no reflected type");
+ }
+
List<TypeVariableMirror> get typeVariables => emptyList;
List<TypeMirror> get typeArguments => emptyList;
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698