OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.ast_to_text; | 4 library kernel.ast_to_text; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../import_table.dart'; | 7 import '../import_table.dart'; |
8 | 8 |
9 class Namer<T> { | 9 class Namer<T> { |
10 int index = 0; | 10 int index = 0; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 return '$member::$name'; | 258 return '$member::$name'; |
259 } else if (node.parent is Class) { | 259 } else if (node.parent is Class) { |
260 String className = getClassReference(node.parent); | 260 String className = getClassReference(node.parent); |
261 return '$className::$name'; | 261 return '$className::$name'; |
262 } else { | 262 } else { |
263 return name; // Bound inside a function type. | 263 return name; // Bound inside a function type. |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 void writeLibraryFile(Library library) { | 267 void writeLibraryFile(Library library) { |
| 268 writeAnnotationList(library.annotations); |
268 writeWord('library'); | 269 writeWord('library'); |
269 if (library.name != null) { | 270 if (library.name != null) { |
270 writeWord(library.name); | 271 writeWord(library.name); |
271 } | 272 } |
272 endLine(';'); | 273 endLine(';'); |
273 var imports = new LibraryImportTable(library); | 274 var imports = new LibraryImportTable(library); |
274 for (var library in imports.importedLibraries) { | 275 for (var library in imports.importedLibraries) { |
275 var importPath = imports.getImportPath(library); | 276 var importPath = imports.getImportPath(library); |
276 if (importPath == "") { | 277 if (importPath == "") { |
277 var prefix = | 278 var prefix = |
(...skipping 23 matching lines...) Expand all Loading... |
301 writeSpaced('='); | 302 writeSpaced('='); |
302 inner.writeMemberReference(program.mainMethod); | 303 inner.writeMemberReference(program.mainMethod); |
303 endLine(';'); | 304 endLine(';'); |
304 for (var library in program.libraries) { | 305 for (var library in program.libraries) { |
305 if (library.isExternal) { | 306 if (library.isExternal) { |
306 if (!showExternal) { | 307 if (!showExternal) { |
307 continue; | 308 continue; |
308 } | 309 } |
309 writeWord('external'); | 310 writeWord('external'); |
310 } | 311 } |
| 312 writeAnnotationList(library.annotations); |
311 writeWord('library'); | 313 writeWord('library'); |
312 if (library.name != null) { | 314 if (library.name != null) { |
313 writeWord(library.name); | 315 writeWord(library.name); |
314 } | 316 } |
315 if (library.importUri != null) { | 317 if (library.importUri != null) { |
316 writeSpaced('from'); | 318 writeSpaced('from'); |
317 writeWord('"${library.importUri}"'); | 319 writeWord('"${library.importUri}"'); |
318 } | 320 } |
319 var prefix = syntheticNames.nameLibraryPrefix(library); | 321 var prefix = syntheticNames.nameLibraryPrefix(library); |
320 writeSpaced('as'); | 322 writeSpaced('as'); |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 } | 1655 } |
1654 throw 'illegal ProcedureKind: $kind'; | 1656 throw 'illegal ProcedureKind: $kind'; |
1655 } | 1657 } |
1656 | 1658 |
1657 class ExpressionPrinter { | 1659 class ExpressionPrinter { |
1658 final Printer writeer; | 1660 final Printer writeer; |
1659 final int minimumPrecedence; | 1661 final int minimumPrecedence; |
1660 | 1662 |
1661 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1663 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
1662 } | 1664 } |
OLD | NEW |