| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // is unique, but also emit closure classes after all other | 124 // is unique, but also emit closure classes after all other |
| 125 // classes (since the emitter sorts classes by their id). | 125 // classes (since the emitter sorts classes by their id). |
| 126 compiler.getNextFreeClassId(), | 126 compiler.getNextFreeClassId(), |
| 127 STATE_DONE) { | 127 STATE_DONE) { |
| 128 ClassElement superclass = methodElement.isInstanceMember() | 128 ClassElement superclass = methodElement.isInstanceMember() |
| 129 ? compiler.boundClosureClass | 129 ? compiler.boundClosureClass |
| 130 : compiler.closureClass; | 130 : compiler.closureClass; |
| 131 superclass.ensureResolved(compiler); | 131 superclass.ensureResolved(compiler); |
| 132 supertype = superclass.computeType(compiler); | 132 supertype = superclass.computeType(compiler); |
| 133 interfaces = const Link<DartType>(); | 133 interfaces = const Link<DartType>(); |
| 134 allSupertypes = const Link<DartType>().prepend(supertype); | |
| 135 thisType = rawType = new InterfaceType(this); | 134 thisType = rawType = new InterfaceType(this); |
| 135 allSupertypesAndSelf = |
| 136 superclass.allSupertypesAndSelf.extendClass(thisType); |
| 136 } | 137 } |
| 137 | 138 |
| 138 bool isClosure() => true; | 139 bool isClosure() => true; |
| 139 | 140 |
| 140 Token position() => node.getBeginToken(); | 141 Token position() => node.getBeginToken(); |
| 141 | 142 |
| 142 Node parseNode(DiagnosticListener listener) => node; | 143 Node parseNode(DiagnosticListener listener) => node; |
| 143 | 144 |
| 144 /** | 145 /** |
| 145 * The most outer method this closure is declared into. | 146 * The most outer method this closure is declared into. |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 831 } |
| 831 | 832 |
| 832 visitTryStatement(TryStatement node) { | 833 visitTryStatement(TryStatement node) { |
| 833 // TODO(ngeoffray): implement finer grain state. | 834 // TODO(ngeoffray): implement finer grain state. |
| 834 bool oldInTryStatement = inTryStatement; | 835 bool oldInTryStatement = inTryStatement; |
| 835 inTryStatement = true; | 836 inTryStatement = true; |
| 836 node.visitChildren(this); | 837 node.visitChildren(this); |
| 837 inTryStatement = oldInTryStatement; | 838 inTryStatement = oldInTryStatement; |
| 838 } | 839 } |
| 839 } | 840 } |
| OLD | NEW |