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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 24197003: Support typeVariables in ClassMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/lib/js_mirrors.dart » ('j') | sdk/lib/_internal/lib/js_mirrors.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index ba51d89b47d7c917b1913646eacefaa8768d3342..6de74809281cde486211263873b7257de1179656 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -2010,6 +2010,20 @@ class CodeEmitterTask extends CompilerTask {
builder.addProperty("@", metadata);
}
+ if (backend.isNeededForReflection(classElement)) {
+ List typeVars = [];
+ for (TypeVariableType typeVar in classElement.typeVariables) {
+ typeVars.add(js.string(typeVar.name.slowToString()));
+ typeVars.add(js.toExpression(reifyType(typeVar.element.bound)));
+ }
+
+ var superclass = classElement.superclass;
karlklose 2013/09/23 08:50:34 Please add a type annotation.
zarah 2013/09/23 11:17:02 Done.
+ if ((!typeVars.isEmpty && superclass == null)
karlklose 2013/09/23 08:50:34 You could save the result of this check in a local
zarah 2013/09/23 11:17:02 Done.
+ || (superclass != null
+ && superclass.typeVariables != classElement.typeVariables)) {
karlklose 2013/09/23 08:50:34 Consider storing classElement.typeVariables in a l
zarah 2013/09/23 11:17:02 Done.
+ builder.addProperty('<>', new jsAst.ArrayInitializer.from(typeVars));
karlklose 2013/09/23 08:50:34 We should move the '<>' into the namer (not this C
zarah 2013/09/23 11:17:02 OK.
+ }
+ }
List<CodeBuffer> classBuffers = elementBuffers[classElement];
if (classBuffers == null) {
classBuffers = [];
« no previous file with comments | « no previous file | sdk/lib/_internal/lib/js_mirrors.dart » ('j') | sdk/lib/_internal/lib/js_mirrors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698