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

Unified Diff: sdk/lib/_internal/lib/js_mirrors.dart

Issue 26472002: Add TypeVariable object on runtime to support reflection on type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
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 2887c43e96c54ee929b4c4cdeee517e96f7c0d8f..9461d92a85b88eb54b4bc56b69ec85b7607339e8 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -27,7 +27,8 @@ import 'dart:_js_helper' show
getMangledTypeName,
throwInvalidReflectionError,
hasReflectableProperty,
- runtimeTypeToString;
+ runtimeTypeToString,
+ TypeVariable;
import 'dart:_interceptors' show
Interceptor,
JSExtendableArray;
@@ -1320,12 +1321,13 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
List typeVars =
JS('JSExtendableArray|Null', '#.prototype["<>"]', _jsConstructor);
if (typeVars == null) return result;
- for (int i = 0; i < typeVars.length; i += 2) {
+ for (int i = 0; i < typeVars.length; i++) {
+ TypeVariable typeVar = JS('', 'init.metadata[#]', typeVars[i]);
+ var bound = JS('', 'init.metadata[#]', typeVar.bound);
TypeMirror upperBound =
- typeMirrorFromRuntimeTypeRepresentation(JS('', 'init.metadata[#]',
- typeVars[i+1]));
- var typeMirror =
- new JsTypeVariableMirror(s(typeVars[i]), upperBound, this);
+ typeMirrorFromRuntimeTypeRepresentation(bound);
+ TypeVariableMirror typeMirror =
+ new JsTypeVariableMirror(s(typeVar.name), upperBound, this);
ahe 2013/10/14 13:07:07 Why isn't this simply: TypeVariable typeVar = JS(
zarah 2013/10/15 14:20:02 Done.
result.add(typeMirror);
}
return _cachedTypeVariables = new UnmodifiableListView(result);

Powered by Google App Engine
This is Rietveld 408576698