| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library closureToClassMapper; | 5 library closureToClassMapper; |
| 6 | 6 |
| 7 import "elements/elements.dart"; | 7 import "elements/elements.dart"; |
| 8 import "dart2jslib.dart"; | 8 import "dart2jslib.dart"; |
| 9 import "dart_types.dart"; | 9 import "dart_types.dart"; |
| 10 import "scanner/scannerlib.dart" show Token; | 10 import "scanner/scannerlib.dart" show Token; |
| 11 import "tree/tree.dart"; | 11 import "tree/tree.dart"; |
| 12 import "util/util.dart"; | 12 import "util/util.dart"; |
| 13 import "elements/modelx.dart" show ElementX, FunctionElementX, ClassElementX; | 13 import "elements/modelx.dart" show ElementX, FunctionElementX, ClassElementX; |
| 14 | 14 |
| 15 class ClosureNamer { | 15 class ClosureNamer { |
| 16 SourceString getClosureVariableName(SourceString name, int id) { | 16 SourceString getClosureVariableName(SourceString name, int id) { |
| 17 return new SourceString("${name.slowToString()}_$id"); | 17 return new SourceString("${name.slowToString()}_$id"); |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 | 21 |
| 22 class ClosureTask extends CompilerTask { | 22 class ClosureTask extends CompilerTask { |
| 23 Map<Node, ClosureClassMap> closureMappingCache; | 23 Map<Node, ClosureClassMap> closureMappingCache; |
| 24 ClosureNamer namer; | 24 ClosureNamer namer; |
| 25 ClosureTask(Compiler compiler, this.namer) | 25 ClosureTask(Compiler compiler, this.namer) |
| 26 : closureMappingCache = new Map<Node, ClosureClassMap>(), | 26 : closureMappingCache = new Map<Node, ClosureClassMap>(), |
| 27 super(compiler); | 27 super(compiler); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 } | 690 } |
| 691 | 691 |
| 692 visitTryStatement(TryStatement node) { | 692 visitTryStatement(TryStatement node) { |
| 693 // TODO(ngeoffray): implement finer grain state. | 693 // TODO(ngeoffray): implement finer grain state. |
| 694 bool oldInTryStatement = inTryStatement; | 694 bool oldInTryStatement = inTryStatement; |
| 695 inTryStatement = true; | 695 inTryStatement = true; |
| 696 node.visitChildren(this); | 696 node.visitChildren(this); |
| 697 inTryStatement = oldInTryStatement; | 697 inTryStatement = oldInTryStatement; |
| 698 } | 698 } |
| 699 } | 699 } |
| OLD | NEW |