| 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 interface TreeElements { | 5 interface TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 Type getType(TypeAnnotation annotation); | 8 Type getType(TypeAnnotation annotation); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 compiler.withCurrentElement(cls, () => measure(() { | 230 compiler.withCurrentElement(cls, () => measure(() { |
| 231 if (cls.supertypeLoadState == ClassElement.STATE_DONE) return; | 231 if (cls.supertypeLoadState == ClassElement.STATE_DONE) return; |
| 232 if (cls.supertypeLoadState == ClassElement.STATE_STARTED) { | 232 if (cls.supertypeLoadState == ClassElement.STATE_STARTED) { |
| 233 compiler.reportMessage( | 233 compiler.reportMessage( |
| 234 compiler.spanFromNode(from), | 234 compiler.spanFromNode(from), |
| 235 MessageKind.CYCLIC_CLASS_HIERARCHY.error([cls.name]), | 235 MessageKind.CYCLIC_CLASS_HIERARCHY.error([cls.name]), |
| 236 api.Diagnostic.ERROR); | 236 api.Diagnostic.ERROR); |
| 237 cls.supertypeLoadState = ClassElement.STATE_DONE; | 237 cls.supertypeLoadState = ClassElement.STATE_DONE; |
| 238 cls.allSupertypes = const EmptyLink<Type>().prepend( | 238 cls.allSupertypes = const EmptyLink<Type>().prepend( |
| 239 compiler.objectClass.computeType(compiler)); | 239 compiler.objectClass.computeType(compiler)); |
| 240 // TODO(ahe): We should also set cls.supertype here to avoid |
| 241 // creating a malformed class hierarchy. |
| 240 return; | 242 return; |
| 241 } | 243 } |
| 242 cls.supertypeLoadState = ClassElement.STATE_STARTED; | 244 cls.supertypeLoadState = ClassElement.STATE_STARTED; |
| 243 compiler.withCurrentElement(cls, () { | 245 compiler.withCurrentElement(cls, () { |
| 244 // TODO(ahe): Cache the node in cls. | 246 // TODO(ahe): Cache the node in cls. |
| 245 cls.parseNode(compiler).accept(new ClassSupertypeResolver(compiler, | 247 cls.parseNode(compiler).accept(new ClassSupertypeResolver(compiler, |
| 246 cls)); | 248 cls)); |
| 247 if (cls.supertypeLoadState != ClassElement.STATE_DONE) { | 249 if (cls.supertypeLoadState != ClassElement.STATE_DONE) { |
| 248 cls.supertypeLoadState = ClassElement.STATE_DONE; | 250 cls.supertypeLoadState = ClassElement.STATE_DONE; |
| 249 } | 251 } |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2397 TopScope(LibraryElement library) : super(null, library); | 2399 TopScope(LibraryElement library) : super(null, library); |
| 2398 Element lookup(SourceString name) { | 2400 Element lookup(SourceString name) { |
| 2399 return library.find(name); | 2401 return library.find(name); |
| 2400 } | 2402 } |
| 2401 | 2403 |
| 2402 Element add(Element newElement) { | 2404 Element add(Element newElement) { |
| 2403 throw "Cannot add an element in the top scope"; | 2405 throw "Cannot add an element in the top scope"; |
| 2404 } | 2406 } |
| 2405 String toString() => '$element'; | 2407 String toString() => '$element'; |
| 2406 } | 2408 } |
| OLD | NEW |