| 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 /** | 5 /** |
| 6 * Dart backend helper for converting program IR back to source code. | 6 * Dart backend helper for converting program IR back to source code. |
| 7 */ | 7 */ |
| 8 class Emitter { | 8 class Emitter { |
| 9 | 9 |
| 10 final Compiler compiler; | 10 final Compiler compiler; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 classNode.extendsKeyword.value.printOn(sb); | 40 classNode.extendsKeyword.value.printOn(sb); |
| 41 sb.add(' '); | 41 sb.add(' '); |
| 42 sb.add(renamer.renameType(classElement.supertype)); | 42 sb.add(renamer.renameType(classElement.supertype)); |
| 43 } | 43 } |
| 44 if (!classNode.interfaces.isEmpty()) { | 44 if (!classNode.interfaces.isEmpty()) { |
| 45 sb.add(classElement.isInterface() ? ' extends ' : ' implements '); | 45 sb.add(classElement.isInterface() ? ' extends ' : ' implements '); |
| 46 sb.add(unparser.unparse(classNode.interfaces)); | 46 sb.add(unparser.unparse(classNode.interfaces)); |
| 47 } | 47 } |
| 48 if (classNode.defaultClause !== null) { | 48 if (classNode.defaultClause !== null) { |
| 49 sb.add(' default '); | 49 sb.add(' default '); |
| 50 sb.add(unparser.unparse(classNode.defaultClause)); | 50 sb.add(renamer.renameType(classElement.defaultClass)); |
| 51 } | 51 } |
| 52 sb.add('{'); | 52 sb.add('{'); |
| 53 innerElements.forEach((element) { | 53 innerElements.forEach((element) { |
| 54 // TODO(smok): Filter out default constructors here. | 54 // TODO(smok): Filter out default constructors here. |
| 55 outputElement(element); | 55 outputElement(element); |
| 56 }); | 56 }); |
| 57 sb.add('}'); | 57 sb.add('}'); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void outputElement(Element element) { | 60 void outputElement(Element element) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 82 if (!uri.startsWith('dart:')) continue; | 82 if (!uri.startsWith('dart:')) continue; |
| 83 final lib = libraries[uri]; | 83 final lib = libraries[uri]; |
| 84 if (renamer.imports.containsKey(lib)) { | 84 if (renamer.imports.containsKey(lib)) { |
| 85 result.add('#import("$uri", prefix: "${renamer.imports[lib]}");'); | 85 result.add('#import("$uri", prefix: "${renamer.imports[lib]}");'); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 result.add(sb); | 88 result.add(sb); |
| 89 return result.toString(); | 89 return result.toString(); |
| 90 } | 90 } |
| 91 } | 91 } |
| OLD | NEW |