| 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 compiler.closureClass.ensureResolved(compiler); | 115 ClassElement superclass = methodElement.isInstanceMember() |
| 116 supertype = compiler.closureClass.computeType(compiler); | 116 ? compiler.boundClosureClass |
| 117 : compiler.closureClass; |
| 118 superclass.ensureResolved(compiler); |
| 119 supertype = superclass.computeType(compiler); |
| 117 interfaces = const Link<DartType>(); | 120 interfaces = const Link<DartType>(); |
| 118 allSupertypes = const Link<DartType>().prepend(supertype); | 121 allSupertypes = const Link<DartType>().prepend(supertype); |
| 119 thisType = rawType = new InterfaceType(this); | 122 thisType = rawType = new InterfaceType(this); |
| 120 } | 123 } |
| 121 | 124 |
| 122 bool isClosure() => true; | 125 bool isClosure() => true; |
| 123 | 126 |
| 124 Token position() => node.getBeginToken(); | 127 Token position() => node.getBeginToken(); |
| 125 | 128 |
| 126 Node parseNode(DiagnosticListener listener) => node; | 129 Node parseNode(DiagnosticListener listener) => node; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 } | 802 } |
| 800 | 803 |
| 801 visitTryStatement(TryStatement node) { | 804 visitTryStatement(TryStatement node) { |
| 802 // TODO(ngeoffray): implement finer grain state. | 805 // TODO(ngeoffray): implement finer grain state. |
| 803 bool oldInTryStatement = inTryStatement; | 806 bool oldInTryStatement = inTryStatement; |
| 804 inTryStatement = true; | 807 inTryStatement = true; |
| 805 node.visitChildren(this); | 808 node.visitChildren(this); |
| 806 inTryStatement = oldInTryStatement; | 809 inTryStatement = oldInTryStatement; |
| 807 } | 810 } |
| 808 } | 811 } |
| OLD | NEW |