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

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..2f08c14d0cacaa18d48516d8f8cb2adf4334c802 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,13 @@ 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));
ahe 2013/10/15 14:56:31 Long line.
zarah 2013/10/16 07:00:47 Done.
+ });
+
+ return addGlobalMetadata(
+ jsAst.prettyPrint(representation, compiler).getText());
}
int reifyName(SourceString name) {

Powered by Google App Engine
This is Rietveld 408576698