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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart

Issue 968843003: Implement type argument access and reification of runtime types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Unbreak long line. Created 5 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 | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
index fd1f21d09bde30b70c2ea1006da5416c718943dc..1ee1b802bb4d260d0cf6f62d0baa55d7964a6ea1 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_visitor.dart
@@ -857,14 +857,15 @@ abstract class IrBuilderVisitor extends ResolvedVisitor<ir.Primitive>
DartType type = elements.getTypeLiteralType(node);
if (type is TypeVariableType) {
- ir.Primitive prim = new ir.ReifyTypeVar(type.element);
- irBuilder.add(new ir.LetPrim(prim));
- return prim;
+ return buildReifyTypeVariable(irBuilder.buildThis(), type);
} else {
return translateConstant(node);
}
}
+ ir.Primitive buildReifyTypeVariable(ir.Primitive target,
+ TypeVariableType variable);
+
ir.Primitive visitSendSet(ast.SendSet node) {
assert(irBuilder.isOpen);
Element element = elements[node];
@@ -1278,6 +1279,15 @@ class DartIrBuilderVisitor extends IrBuilderVisitor {
List<ir.Primitive> arguments) {
return arguments;
}
+
+ @override
+ ir.Primitive buildReifyTypeVariable(ir.Primitive target,
+ TypeVariableType variable) {
+ assert(target is ir.This);
+ ir.Primitive prim = new ir.ReifyTypeVar(variable.element);
+ irBuilder.add(new ir.LetPrim(prim));
+ return prim;
+ }
}
/// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder].
@@ -1803,6 +1813,16 @@ class JsIrBuilderVisitor extends IrBuilderVisitor {
}
return result;
}
+
+ @override
+ ir.Primitive buildReifyTypeVariable(ir.Primitive target,
+ TypeVariableType variable) {
+ ir.Primitive typeArgument = new ir.ReadTypeVariable(variable, target);
+ irBuilder.add(new ir.LetPrim(typeArgument));
+ ir.Primitive type = new ir.ReifyRuntimeType(typeArgument);
+ irBuilder.add(new ir.LetPrim(type));
+ return type;
+ }
}
/// Interface for generating [SourceInformation] for the CPS.
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698