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("leg.dart"); | 8 #import("leg.dart"); |
9 #import("scanner/scannerlib.dart"); | 9 #import("scanner/scannerlib.dart"); |
10 #import("tree/tree.dart"); | 10 #import("tree/tree.dart"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 class ClosureClassElement extends ClassElement { | 60 class ClosureClassElement extends ClassElement { |
61 ClosureClassElement(SourceString name, | 61 ClosureClassElement(SourceString name, |
62 Compiler compiler, | 62 Compiler compiler, |
63 Element enclosingElement) | 63 Element enclosingElement) |
64 : super(name, | 64 : super(name, |
65 enclosingElement, | 65 enclosingElement, |
66 // By assigning a fresh class-id we make sure that the hashcode | 66 // By assigning a fresh class-id we make sure that the hashcode |
67 // is unique, but also emit closure classes after all other | 67 // is unique, but also emit closure classes after all other |
68 // classes (since the emitter sorts classes by their id). | 68 // classes (since the emitter sorts classes by their id). |
69 compiler.getNextFreeClassId()) { | 69 compiler.getNextFreeClassId(), |
70 // We assign twice to [supertypeLoadState] as it contains asserts | 70 ClassElement.STATE_DONE) { |
71 // which enforce certain sequence of transitions. | |
72 supertypeLoadState = ClassElement.STATE_STARTED; | |
73 supertypeLoadState = ClassElement.STATE_DONE; | |
74 // Same as for [supertypeLoadState] above. | |
75 resolutionState = ClassElement.STATE_STARTED; | |
76 resolutionState = ClassElement.STATE_DONE; | |
77 compiler.closureClass.ensureResolved(compiler); | 71 compiler.closureClass.ensureResolved(compiler); |
78 supertype = compiler.closureClass.computeType(compiler); | 72 supertype = compiler.closureClass.computeType(compiler); |
79 interfaces = const EmptyLink<Type>(); | 73 interfaces = const EmptyLink<Type>(); |
80 allSupertypes = new Link<Type>(supertype); | 74 allSupertypes = new Link<Type>(supertype); |
81 } | 75 } |
82 bool isClosure() => true; | 76 bool isClosure() => true; |
83 } | 77 } |
84 | 78 |
85 class BoxElement extends Element { | 79 class BoxElement extends Element { |
86 BoxElement(SourceString name, Element enclosingElement) | 80 BoxElement(SourceString name, Element enclosingElement) |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 499 } |
506 | 500 |
507 visitTryStatement(TryStatement node) { | 501 visitTryStatement(TryStatement node) { |
508 // TODO(ngeoffray): implement finer grain state. | 502 // TODO(ngeoffray): implement finer grain state. |
509 bool oldInTryStatement = inTryStatement; | 503 bool oldInTryStatement = inTryStatement; |
510 inTryStatement = true; | 504 inTryStatement = true; |
511 node.visitChildren(this); | 505 node.visitChildren(this); |
512 inTryStatement = oldInTryStatement; | 506 inTryStatement = oldInTryStatement; |
513 } | 507 } |
514 } | 508 } |
OLD | NEW |