Chromium Code Reviews| Index: pkg/kernel/lib/transformations/closure/info.dart |
| diff --git a/pkg/kernel/lib/transformations/closure/info.dart b/pkg/kernel/lib/transformations/closure/info.dart |
| index 68b82c1dc5e51e0c5fd4393e813aafc780f3a49d..082209aeca85e1da8a789d85dcff7d8c313e2460 100644 |
| --- a/pkg/kernel/lib/transformations/closure/info.dart |
| +++ b/pkg/kernel/lib/transformations/closure/info.dart |
| @@ -30,6 +30,8 @@ class ClosureInfo extends RecursiveVisitor { |
| final Set<VariableDeclaration> variables = new Set<VariableDeclaration>(); |
| + /// Map from functions to set of type variables captured within them. |
| + /// |
|
karlklose
2017/07/25 09:38:23
Remove empty comment line.
sjindel
2017/07/25 13:11:48
Done.
|
| final Map<FunctionNode, Set<TypeParameter>> typeVariables = |
| <FunctionNode, Set<TypeParameter>>{}; |
| @@ -166,7 +168,8 @@ class ClosureInfo extends RecursiveVisitor { |
| // Propagate captured type variables to enclosing function. |
| typeVariables |
| .putIfAbsent(currentFunction, () => new Set<TypeParameter>()) |
| - .addAll(capturedTypeVariables); |
| + .addAll( |
| + capturedTypeVariables.where((t) => t.parent != currentFunction)); |
|
karlklose
2017/07/25 09:38:23
Consider adding a comment here to explain when 't.
sjindel
2017/07/25 13:11:48
Done.
Dmitry Stefantsov
2017/07/26 09:12:09
Karl may correct me, but I think using square brac
karlklose
2017/07/26 10:36:30
Yes, you should use `` for code fragments. Note th
|
| } |
| } |
| @@ -190,7 +193,7 @@ class ClosureInfo extends RecursiveVisitor { |
| } |
| visitTypeParameterType(TypeParameterType node) { |
| - if (!isOuterMostContext) { |
| + if (!isOuterMostContext && node.parameter.parent != currentFunction) { |
| typeVariables |
| .putIfAbsent(currentFunction, () => new Set<TypeParameter>()) |
| .add(node.parameter); |