Index: sdk/lib/_internal/lib/js_mirrors.dart |
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart |
index 912af14a257dfcc692e14c9b283ab7f93312b26d..c322846f94b1e3723cebeee027417d7aed3e5a8e 100644 |
--- a/sdk/lib/_internal/lib/js_mirrors.dart |
+++ b/sdk/lib/_internal/lib/js_mirrors.dart |
@@ -4,7 +4,7 @@ |
library dart._js_mirrors; |
-import 'dart:async'; |
+import '../compiler/implementation/runtime_data.dart' as encoding; |
import 'dart:collection' show |
UnmodifiableListView, |
@@ -334,10 +334,12 @@ class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror |
var cls = reflectClassByMangledName(className); |
if (cls is ClassMirror) { |
cls = cls.originalDeclaration; |
- if (cls is JsClassMirror) { |
- result[cls.simpleName] = cls; |
- cls._owner = this; |
- } |
+ } |
+ if (cls is JsClassMirror) { |
+ result[cls.simpleName] = cls; |
+ cls._owner = this; |
+ } else if (cls is JsTypedefMirror) { |
+ result[cls.simpleName] = cls; |
} |
} |
return _cachedClasses = |
@@ -572,12 +574,6 @@ TypeMirror reflectClassByName(Symbol symbol, String mangledName) { |
} |
var constructor = JS('var', 'init.allClasses[#]', mangledName); |
if (constructor == null) { |
- int index = JS('int|Null', 'init.functionAliases[#]', mangledName); |
- if (index != null) { |
- mirror = new JsTypedefMirror(symbol, mangledName, getMetadata(index)); |
- JsCache.update(classMirrors, mangledName, mirror); |
- return mirror; |
- } |
// Probably an intercepted class. |
// TODO(ahe): How to handle intercepted classes? |
throw new UnsupportedError('Cannot find class for: ${n(symbol)}'); |
@@ -602,23 +598,28 @@ TypeMirror reflectClassByName(Symbol symbol, String mangledName) { |
} |
} |
- var superclassName = fields.split(';')[0]; |
- var mixins = superclassName.split('+'); |
- if (mixins.length > 1 && mangledGlobalNames[mangledName] == null) { |
- mirror = reflectMixinApplication(mixins, mangledName); |
+ if (encoding.isTypedefDescriptor(fields)) { |
+ int index = encoding.getTypeFromTypedef(fields); |
+ mirror = new JsTypedefMirror(symbol, mangledName, getMetadata(index)); |
} else { |
- ClassMirror classMirror = new JsClassMirror( |
- symbol, mangledName, constructor, fields, fieldsMetadata); |
- List typeVariables = |
- JS('JSExtendableArray|Null', '#.prototype["<>"]', constructor); |
- if (typeVariables == null || typeVariables.length == 0) { |
- mirror = classMirror; |
+ var superclassName = fields.split(';')[0]; |
+ var mixins = superclassName.split('+'); |
+ if (mixins.length > 1 && mangledGlobalNames[mangledName] == null) { |
+ mirror = reflectMixinApplication(mixins, mangledName); |
} else { |
- String typeArguments = 'dynamic'; |
- for (int i = 1; i < typeVariables.length; i++) { |
- typeArguments += ',dynamic'; |
+ ClassMirror classMirror = new JsClassMirror( |
+ symbol, mangledName, constructor, fields, fieldsMetadata); |
+ List typeVariables = |
+ JS('JSExtendableArray|Null', '#.prototype["<>"]', constructor); |
+ if (typeVariables == null || typeVariables.length == 0) { |
+ mirror = classMirror; |
+ } else { |
+ String typeArguments = 'dynamic'; |
+ for (int i = 1; i < typeVariables.length; i++) { |
+ typeArguments += ',dynamic'; |
+ } |
+ mirror = new JsTypeBoundClassMirror(classMirror, typeArguments); |
} |
- mirror = new JsTypeBoundClassMirror(classMirror, typeArguments); |
} |
} |