| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Compiler compiler, | 105 Compiler compiler, |
| 106 this.methodElement, | 106 this.methodElement, |
| 107 Element enclosingElement) | 107 Element enclosingElement) |
| 108 : super(name, | 108 : super(name, |
| 109 enclosingElement, | 109 enclosingElement, |
| 110 // By assigning a fresh class-id we make sure that the hashcode | 110 // By assigning a fresh class-id we make sure that the hashcode |
| 111 // is unique, but also emit closure classes after all other | 111 // is unique, but also emit closure classes after all other |
| 112 // classes (since the emitter sorts classes by their id). | 112 // classes (since the emitter sorts classes by their id). |
| 113 compiler.getNextFreeClassId(), | 113 compiler.getNextFreeClassId(), |
| 114 STATE_DONE) { | 114 STATE_DONE) { |
| 115 ClassElement superclass = methodElement.isInstanceMember() | 115 compiler.closureClass.ensureResolved(compiler); |
| 116 ? compiler.boundClosureClass | 116 supertype = compiler.closureClass.computeType(compiler); |
| 117 : compiler.closureClass; | |
| 118 superclass.ensureResolved(compiler); | |
| 119 supertype = superclass.computeType(compiler); | |
| 120 interfaces = const Link<DartType>(); | 117 interfaces = const Link<DartType>(); |
| 121 allSupertypes = const Link<DartType>().prepend(supertype); | 118 allSupertypes = const Link<DartType>().prepend(supertype); |
| 122 thisType = rawType = new InterfaceType(this); | 119 thisType = rawType = new InterfaceType(this); |
| 123 } | 120 } |
| 124 | 121 |
| 125 bool isClosure() => true; | 122 bool isClosure() => true; |
| 126 | 123 |
| 127 Token position() => node.getBeginToken(); | 124 Token position() => node.getBeginToken(); |
| 128 | 125 |
| 129 Node parseNode(DiagnosticListener listener) => node; | 126 Node parseNode(DiagnosticListener listener) => node; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 799 } |
| 803 | 800 |
| 804 visitTryStatement(TryStatement node) { | 801 visitTryStatement(TryStatement node) { |
| 805 // TODO(ngeoffray): implement finer grain state. | 802 // TODO(ngeoffray): implement finer grain state. |
| 806 bool oldInTryStatement = inTryStatement; | 803 bool oldInTryStatement = inTryStatement; |
| 807 inTryStatement = true; | 804 inTryStatement = true; |
| 808 node.visitChildren(this); | 805 node.visitChildren(this); |
| 809 inTryStatement = oldInTryStatement; | 806 inTryStatement = oldInTryStatement; |
| 810 } | 807 } |
| 811 } | 808 } |
| OLD | NEW |