Chromium Code Reviews| 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 6cdec14b9abd7096ef4cddb4c1b865b65fdb8e32..ed1a2898d16f6a5d9394a51e357f5313cbba3e60 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 |
| @@ -956,14 +956,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(new ir.This(), type); |
|
asgerf
2015/03/02 13:52:36
Use irBuilder.buildThis(), otherwise 'this' inside
karlklose
2015/03/05 09:54:58
Done.
|
| } 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]; |
| @@ -1377,6 +1378,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); |
|
asgerf
2015/03/02 13:52:36
FYI I believe this assertion is still valid with t
karlklose
2015/03/05 09:54:58
Acknowledged.
|
| + 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]. |
| @@ -1903,5 +1913,18 @@ class JsIrBuilderVisitor extends IrBuilderVisitor { |
| return result; |
| } |
| + |
| + @override |
| + ir.Primitive buildReifyTypeVariable(ir.Primitive target, |
| + TypeVariableType variable) { |
| + ClassElement context = variable.element.enclosingClass; |
| + irBuilder.add(new ir.LetPrim(target)); |
| + ir.Primitive typeArgument = |
| + new ir.ReadTypeVariable(variable, context, target); |
|
asgerf
2015/03/02 13:52:36
This seems wrong. We are always passing variable.e
karlklose
2015/03/05 09:54:58
I removed the context. We do not need it until we
|
| + irBuilder.add(new ir.LetPrim(typeArgument)); |
| + var type = new ir.ReifyRuntimeType(typeArgument); |
| + irBuilder.add(new ir.LetPrim(type)); |
| + return type; |
| + } |
| } |