Chromium Code Reviews| Index: pkg/compiler/lib/src/closure.dart |
| diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart |
| index 2b4278a25e45601dffb30c76104a9dad04e2435a..26be76d4d202b2139d987eafcf85217894ea1aca 100644 |
| --- a/pkg/compiler/lib/src/closure.dart |
| +++ b/pkg/compiler/lib/src/closure.dart |
| @@ -131,7 +131,7 @@ class ClosureFieldElement extends ElementX |
| bool get hasResolvedAst => hasTreeElements; |
| ResolvedAst get resolvedAst { |
| - return new ParsedResolvedAst(this, null, treeElements); |
| + return new ParsedResolvedAst(this, null, null, treeElements); |
| } |
| Expression get initializer { |
| @@ -346,7 +346,7 @@ class SynthesizedCallMethodElementX extends BaseFunctionElementX |
| FunctionExpression parseNode(Parsing parsing) => node; |
| ResolvedAst get resolvedAst { |
| - return new ParsedResolvedAst(this, node, treeElements); |
| + return new ParsedResolvedAst(this, node, node.body, treeElements); |
| } |
| Element get analyzableElement => closureClass.methodElement.analyzableElement; |
| @@ -379,6 +379,29 @@ class ClosureScope { |
| f(LocalVariableElement variable, BoxFieldElement boxField)) { |
| capturedVariables.forEach(f); |
| } |
| + |
| + String toString() { |
|
sra1
2016/04/19 03:07:30
I prefer toString() methods to print so that they
Johnni Winther
2016/04/19 07:22:23
Will do in a follow-up.
|
| + StringBuffer sb = new StringBuffer(); |
| + if (boxElement != null) { |
| + sb.write('box=$boxElement'); |
| + } |
| + if (boxedLoopVariables.isNotEmpty) { |
| + if (sb.isNotEmpty) { |
| + sb.write(','); |
| + } |
|
sra1
2016/04/19 03:07:30
I usually do this like so:
var separator = '';
Johnni Winther
2016/04/19 07:22:23
Will do in a follow-up.
|
| + sb.write('boxedLoopVariables=${boxedLoopVariables}'); |
| + } |
| + if (capturedVariables.isNotEmpty) { |
| + if (sb.isNotEmpty) { |
| + sb.write(','); |
| + } |
| + sb.write('capturedVariables='); |
| + capturedVariables.forEach((Local local, BoxFieldElement field) { |
|
sra1
2016/04/19 03:07:30
Might as well just print the map.
Johnni Winther
2016/04/19 07:22:23
Some of the default toString implementations print
|
| + sb.write('$local->${field} '); |
| + }); |
| + } |
| + return sb.toString(); |
| + } |
| } |
| class ClosureClassMap { |