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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.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: Addressed comments. 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/compiler/implementation/js_emitter/code_emitter_task.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
index cea45c9df7c59fa73b4f8a1faeacc8c51d9fe3b5..509755f009f588bddcba1901b740e019cc1b2fe1 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
@@ -49,6 +49,7 @@ class CodeEmitterTask extends CompilerTask {
Set<ClassElement> instantiatedClasses;
JavaScriptBackend get backend => compiler.backend;
+ TypeVariableHandler get typeVariableHandler => backend.typeVariableHandler;
String get _ => space;
String get space => compiler.enableMinification ? "" : " ";
@@ -1621,9 +1622,14 @@ class CodeEmitterTask extends CompilerTask {
}
int reifyType(DartType type) {
- // TODO(ahe): Handle type variables correctly instead of using "#".
- String representation = backend.rti.getTypeRepresentation(type, (_) {});
- return addGlobalMetadata(representation.replaceAll('#', 'null'));
+ jsAst.Expression representation =
+ backend.rti.getTypeRepresentation(type, (variable) {
+ return js.toExpression(
+ typeVariableHandler.reifyTypeVariable(variable.element));
+ });
+
+ return addGlobalMetadata(
+ jsAst.prettyPrint(representation, compiler).getText());
}
int reifyName(SourceString name) {

Powered by Google App Engine
This is Rietveld 408576698