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

Unified Diff: third_party/pkg/di/lib/reflected_type.dart

Issue 180873006: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback 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 | « third_party/pkg/di/lib/module.dart ('k') | third_party/pkg/di/lib/static_injector.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/di/lib/reflected_type.dart
diff --git a/third_party/pkg/di/lib/reflected_type.dart b/third_party/pkg/di/lib/reflected_type.dart
index f58c5f0a94ec0edaee8972d08ce0160ad5ba09ed..cb66f0a470bbdfde552ec88eb56dc21004d1e6a2 100644
--- a/third_party/pkg/di/lib/reflected_type.dart
+++ b/third_party/pkg/di/lib/reflected_type.dart
@@ -6,14 +6,20 @@ library di.src.reflected_type;
override: 'di.src.reflected_type')
import 'dart:mirrors';
+Map<ClassMirror, Type> _cache = <ClassMirror, Type>{};
+
// Horrible hack to work around: http://dartbug.com/12607
Type getReflectedTypeWorkaround(ClassMirror cls) {
// On Dart VM, just return reflectedType.
if (1.0 is! int) return cls.reflectedType;
-
- var mangledName = reflect(cls).getField(_mangledNameField).reflectee;
- Type type = _jsHelper.invoke(#createRuntimeType, [mangledName]).reflectee;
- return type;
+ if (!cls.isOriginalDeclaration) {
+ cls = cls.originalDeclaration;
+ }
+ if (_cache[cls] == null) {
+ var mangledName = reflect(cls).getField(_mangledNameField).reflectee;
+ _cache[cls] = _jsHelper.invoke(#createRuntimeType, [mangledName]).reflectee;
+ }
+ return _cache[cls];
}
final LibraryMirror _jsHelper =
« no previous file with comments | « third_party/pkg/di/lib/module.dart ('k') | third_party/pkg/di/lib/static_injector.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698