Chromium Code Reviews| Index: lib/compiler/implementation/closure.dart |
| diff --git a/lib/compiler/implementation/closure.dart b/lib/compiler/implementation/closure.dart |
| index f278e6ba8ba7b5118f37e1dcb0d93a0f15ef6f9b..bfa29101e403d21265a14fdc2039f775497cf871 100644 |
| --- a/lib/compiler/implementation/closure.dart |
| +++ b/lib/compiler/implementation/closure.dart |
| @@ -317,6 +317,30 @@ class ClosureTranslator extends AbstractVisitor { |
| super.visitSendSet(node); |
| } |
| + visitNewExpression(NewExpression node) { |
| + bool hasTypeVariable(DartType type) { |
| + if (type is TypeVariableType) { |
| + return true; |
| + } else if (type is InterfaceType) { |
| + InterfaceType ifcType = type; |
| + for (DartType argument in ifcType.arguments) { |
| + if (hasTypeVariable(argument)) { |
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| + } |
| + TypeAnnotation annotation = node.send.getTypeAnnotation(); |
| + DartType type = elements.getType(annotation); |
| + if (hasTypeVariable(type)) { |
| + if (closureData.thisElement !== null) { |
|
floitsch
2012/09/03 14:04:15
Add comment why this is necessary. Maybe find a mo
|
| + useLocal(closureData.thisElement); |
| + } |
| + } |
| + node.visitChildren(this); |
| + } |
| + |
| // If variables that are declared in the [node] scope are captured and need |
| // to be boxed create a box-element and update the [capturingScopes] in the |
| // current [closureData]. |