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..6e53b7170ac6448bf0f354f21cd3bd701067688a 100644 |
| --- a/lib/compiler/implementation/closure.dart |
| +++ b/lib/compiler/implementation/closure.dart |
| @@ -317,6 +317,31 @@ 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)) { |
| + // TODO(karlklose): factories cannot get the type argument via this. |
|
ngeoffray
2012/09/03 12:57:23
The resolve must have checked this already. Either
karlklose
2012/09/03 13:55:19
Done.
|
| + if (closureData.thisElement !== null) { |
| + 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]. |