| 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 class BailoutException { | 5 class BailoutException { |
| 6 final String reason; | 6 final String reason; |
| 7 | 7 |
| 8 const BailoutException(this.reason); | 8 const BailoutException(this.reason); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 Collection<LibraryElement> libraries) { | 34 Collection<LibraryElement> libraries) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Adds given class element with its member element to resolved classes | 38 * Adds given class element with its member element to resolved classes |
| 39 * collections. | 39 * collections. |
| 40 */ | 40 */ |
| 41 void addMemberToClass(Element element, ClassElement classElement) { | 41 void addMemberToClass(Element element, ClassElement classElement) { |
| 42 // ${element} should have ${classElement} as enclosing. | 42 // ${element} should have ${classElement} as enclosing. |
| 43 assert(element.enclosingElement == classElement); | 43 assert(element.enclosingElement == classElement); |
| 44 List<Element> resolvedElementsInClass = | 44 Set<Element> resolvedElementsInClass = resolvedClassMembers.putIfAbsent( |
| 45 resolvedClassMembers.putIfAbsent(classElement, () => <Element>[]); | 45 classElement, () => new Set<Element>()); |
| 46 resolvedElementsInClass.add(element); | 46 resolvedElementsInClass.add(element); |
| 47 } | 47 } |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Outputs given class element with given inner elements to a string buffer. | 50 * Outputs given class element with given inner elements to a string buffer. |
| 51 */ | 51 */ |
| 52 void outputClass(ClassElement classElement, List<Element> innerElements, | 52 void outputClass(ClassElement classElement, Set<Element> innerElements, |
| 53 StringBuffer sb) { | 53 StringBuffer sb) { |
| 54 // TODO(smok): Very soon properly print out correct class declaration with | 54 // TODO(smok): Very soon properly print out correct class declaration with |
| 55 // extends, implements, etc. | 55 // extends, implements, etc. |
| 56 sb.add('class '); | 56 sb.add('class '); |
| 57 sb.add(classElement.name.slowToString()); | 57 sb.add(classElement.name.slowToString()); |
| 58 sb.add('{'); | 58 sb.add('{'); |
| 59 innerElements.forEach((element) { | 59 innerElements.forEach((element) { |
| 60 // TODO(smok): Filter out default constructors here. | 60 // TODO(smok): Filter out default constructors here. |
| 61 sb.add(element.parseNode(compiler).unparse()); | 61 sb.add(element.parseNode(compiler).unparse()); |
| 62 }); | 62 }); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 compiler.assembledCode = ''' | 127 compiler.assembledCode = ''' |
| 128 main() { | 128 main() { |
| 129 final bailout_reason = "${e.reason}"; | 129 final bailout_reason = "${e.reason}"; |
| 130 } | 130 } |
| 131 '''; | 131 '''; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 log(String message) => compiler.log('[DartBackend] $message'); | 135 log(String message) => compiler.log('[DartBackend] $message'); |
| 136 } | 136 } |
| OLD | NEW |