Index: pkg/compiler/lib/src/closure.dart |
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart |
index 355e52671e11c2de4f5bae6ae9ba1b2086376126..1b59ee36689b20d639e2ea3c9478ad53e7807b94 100644 |
--- a/pkg/compiler/lib/src/closure.dart |
+++ b/pkg/compiler/lib/src/closure.dart |
@@ -741,7 +741,8 @@ class ClosureTranslator extends Visitor { |
} else { |
Element element = elements[node]; |
if (element != null && element.isTypeVariable) { |
- if (outermostElement.isConstructor) { |
+ if (outermostElement.isConstructor || |
+ outermostElement.isField) { |
TypeVariableElement typeVariable = element; |
useTypeVariableAsLocal(typeVariable.type); |
} else { |
@@ -1081,6 +1082,17 @@ class ClosureTranslator extends Visitor { |
inTryStatement = oldInTryStatement; |
} |
+ visitCatchBlock(CatchBlock node) { |
+ if (node.type != null) { |
+ // The "on T" clause may contain type variables. |
+ analyzeType(elements.getType(node.type)); |
+ } |
+ if (node.formals != null) { |
+ node.formals.visitChildren(this); |
+ } |
+ node.block.accept(this); |
+ } |
+ |
visitAsyncForIn(AsyncForIn node) { |
// An `await for` loop is enclosed in an implicit try-finally. |
bool oldInTryStatement = inTryStatement; |