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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 var importPath = imports.getImportPath(library); | 276 var importPath = imports.getImportPath(library); |
277 if (importPath == "") { | 277 if (importPath == "") { |
278 var prefix = | 278 var prefix = |
279 syntheticNames.nameLibraryPrefix(library, proposedName: 'self'); | 279 syntheticNames.nameLibraryPrefix(library, proposedName: 'self'); |
280 endLine('import self as $prefix;'); | 280 endLine('import self as $prefix;'); |
281 } else { | 281 } else { |
282 var prefix = syntheticNames.nameLibraryPrefix(library); | 282 var prefix = syntheticNames.nameLibraryPrefix(library); |
283 endLine('import "$importPath" as $prefix;'); | 283 endLine('import "$importPath" as $prefix;'); |
284 } | 284 } |
285 } | 285 } |
286 for (var import in library.dependencies) { | |
Siggi Cherem (dart-lang)
2017/07/20 18:29:00
I'm not sure I understand this part of the change.
scheglov
2017/07/20 19:33:53
First of all, this code has not been used, because
Siggi Cherem (dart-lang)
2017/07/20 22:50:36
Thanks so much for the clarification. Given your e
scheglov
2017/07/21 16:21:33
I will add TODO, https://github.com/dart-lang/sdk/
| |
287 import.accept(this); | |
288 } | |
289 endLine(); | 286 endLine(); |
290 var inner = new Printer._inner(this, imports); | 287 var inner = new Printer._inner(this, imports); |
291 library.dependencies.forEach(inner.writeNode); | |
292 library.typedefs.forEach(inner.writeNode); | 288 library.typedefs.forEach(inner.writeNode); |
293 library.classes.forEach(inner.writeNode); | 289 library.classes.forEach(inner.writeNode); |
294 library.fields.forEach(inner.writeNode); | 290 library.fields.forEach(inner.writeNode); |
295 library.procedures.forEach(inner.writeNode); | 291 library.procedures.forEach(inner.writeNode); |
296 } | 292 } |
297 | 293 |
298 void writeProgramFile(Program program) { | 294 void writeProgramFile(Program program) { |
299 ImportTable imports = new ProgramImportTable(program); | 295 ImportTable imports = new ProgramImportTable(program); |
300 var inner = new Printer._inner(this, imports); | 296 var inner = new Printer._inner(this, imports); |
301 writeWord('main'); | 297 writeWord('main'); |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1671 } | 1667 } |
1672 throw 'illegal ProcedureKind: $kind'; | 1668 throw 'illegal ProcedureKind: $kind'; |
1673 } | 1669 } |
1674 | 1670 |
1675 class ExpressionPrinter { | 1671 class ExpressionPrinter { |
1676 final Printer writeer; | 1672 final Printer writeer; |
1677 final int minimumPrecedence; | 1673 final int minimumPrecedence; |
1678 | 1674 |
1679 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1675 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
1680 } | 1676 } |
OLD | NEW |