OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library ddc.src.codegen.dart_codegen; | 5 library ddc.src.codegen.dart_codegen; |
6 | 6 |
7 import 'dart:io' show File; | 7 import 'dart:io' show File; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' as analyzer; | 9 import 'package:analyzer/analyzer.dart' as analyzer; |
10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 // This class emits the code unchanged, for comparison purposes. | 481 // This class emits the code unchanged, for comparison purposes. |
482 class EmptyDartGenerator extends codegenerator.CodeGenerator { | 482 class EmptyDartGenerator extends codegenerator.CodeGenerator { |
483 final CompilerOptions options; | 483 final CompilerOptions options; |
484 | 484 |
485 EmptyDartGenerator(String outDir, Uri root, TypeRules rules, this.options) | 485 EmptyDartGenerator(String outDir, Uri root, TypeRules rules, this.options) |
486 : super(outDir, root, rules); | 486 : super(outDir, root, rules); |
487 | 487 |
| 488 void generateLibrary(Iterable<CompilationUnit> units, LibraryInfo info, |
| 489 CheckerReporter reporter) { |
| 490 for (var unit in units) { |
| 491 var outputDir = makeOutputDirectory(info, unit); |
| 492 reporter.enterSource(unit.element.source); |
| 493 generateUnit(unit, info, outputDir); |
| 494 reporter.leaveSource(); |
| 495 } |
| 496 } |
| 497 |
488 void generateUnit(CompilationUnit unit, LibraryInfo info, String libraryDir) { | 498 void generateUnit(CompilationUnit unit, LibraryInfo info, String libraryDir) { |
489 var uri = unit.element.source.uri; | 499 var uri = unit.element.source.uri; |
490 _log.fine("Emitting original unit " + uri.toString()); | 500 _log.fine("Emitting original unit " + uri.toString()); |
491 FileWriter out = new FileWriter( | 501 FileWriter out = new FileWriter( |
492 options, path.join(libraryDir, '${uri.pathSegments.last}')); | 502 options, path.join(libraryDir, '${uri.pathSegments.last}')); |
493 var unitGen = new EmptyUnitGenerator(unit, out); | 503 var unitGen = new EmptyUnitGenerator(unit, out); |
494 unitGen.generate(); | 504 unitGen.generate(); |
495 out.finalize(); | 505 out.finalize(); |
496 } | 506 } |
497 } | 507 } |
OLD | NEW |