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; |
(...skipping 24 matching lines...) Expand all Loading... |
35 ClosureClassMap cached = closureMappingCache[node]; | 35 ClosureClassMap cached = closureMappingCache[node]; |
36 if (cached != null) return cached; | 36 if (cached != null) return cached; |
37 | 37 |
38 ClosureTranslator translator = | 38 ClosureTranslator translator = |
39 new ClosureTranslator(compiler, elements, closureMappingCache, namer); | 39 new ClosureTranslator(compiler, elements, closureMappingCache, namer); |
40 | 40 |
41 // The translator will store the computed closure-mappings inside the | 41 // The translator will store the computed closure-mappings inside the |
42 // cache. One for given node and one for each nested closure. | 42 // cache. One for given node and one for each nested closure. |
43 if (node is FunctionExpression) { | 43 if (node is FunctionExpression) { |
44 translator.translateFunction(element, node); | 44 translator.translateFunction(element, node); |
| 45 } else if (element.isSynthesized) { |
| 46 return new ClosureClassMap(null, null, null, new ThisElement(element)); |
45 } else { | 47 } else { |
46 // Must be the lazy initializer of a static. | 48 // Must be the lazy initializer of a static. |
47 assert(node is SendSet); | 49 assert(node is SendSet); |
48 translator.translateLazyInitializer(element, node); | 50 translator.translateLazyInitializer(element, node); |
49 } | 51 } |
50 assert(closureMappingCache[node] != null); | 52 assert(closureMappingCache[node] != null); |
51 return closureMappingCache[node]; | 53 return closureMappingCache[node]; |
52 }); | 54 }); |
53 } | 55 } |
54 | 56 |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 817 } |
816 | 818 |
817 visitTryStatement(TryStatement node) { | 819 visitTryStatement(TryStatement node) { |
818 // TODO(ngeoffray): implement finer grain state. | 820 // TODO(ngeoffray): implement finer grain state. |
819 bool oldInTryStatement = inTryStatement; | 821 bool oldInTryStatement = inTryStatement; |
820 inTryStatement = true; | 822 inTryStatement = true; |
821 node.visitChildren(this); | 823 node.visitChildren(this); |
822 inTryStatement = oldInTryStatement; | 824 inTryStatement = oldInTryStatement; |
823 } | 825 } |
824 } | 826 } |
OLD | NEW |