Chromium Code Reviews| Index: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart |
| diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart |
| index 238a3fc354178c391ded72dc64656a50ce0dca43..04f896461b08bbaac81f54425d24c1eaf44091d5 100644 |
| --- a/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart |
| +++ b/pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart |
| @@ -2147,8 +2147,10 @@ class DartCapturedVariables extends ast.Visitor { |
| Element element = elements[node]; |
| if (Elements.isLocal(element)) { |
| LocalElement local = element; |
| - if (insideInitializer) { |
| - assert(local.isParameter); |
| + if (insideInitializer && |
| + local.isParameter && |
| + local.enclosingElement == currentFunction) { |
| + assert(local.enclosingElement.isConstructor); |
| // Initializers in an initializer-list can communicate via parameters. |
| // If a parameter is stored in an initializer list we box it. |
| // TODO(sigurdm): Fix this. |
| @@ -2176,18 +2178,20 @@ class DartCapturedVariables extends ast.Visitor { |
| } |
| visitFunctionExpression(ast.FunctionExpression node) { |
| - FunctionElement oldFunction = currentFunction; |
| + FunctionElement savedFunction = currentFunction; |
| currentFunction = elements[node]; |
| if (currentFunction.asyncMarker != AsyncMarker.SYNC) { |
| giveup(node, "cannot handle async/sync*/async* functions"); |
| } |
| + bool savedInsideInitializer = insideInitializer; |
|
karlklose
2015/08/07 06:00:54
insideInitializers is always false here, isn't it?
Kevin Millikin (Google)
2015/08/07 08:37:13
Yeah, it should be true (that it's always false :)
|
| if (node.initializers != null) { |
| insideInitializer = true; |
| visit(node.initializers); |
| - insideInitializer = false; |
| } |
| + insideInitializer = false; |
| visit(node.body); |
| - currentFunction = oldFunction; |
| + currentFunction = savedFunction; |
| + insideInitializer = savedInsideInitializer; |
| } |
| visitTryStatement(ast.TryStatement node) { |