OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:front_end/compiler_options.dart'; | 7 import 'package:front_end/compiler_options.dart'; |
8 import 'package:front_end/memory_file_system.dart'; | 8 import 'package:front_end/memory_file_system.dart'; |
9 import 'package:front_end/src/base/performace_logger.dart'; | 9 import 'package:front_end/src/base/performace_logger.dart'; |
10 import 'package:front_end/src/base/processed_options.dart'; | 10 import 'package:front_end/src/base/processed_options.dart'; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 647 } |
648 } | 648 } |
649 | 649 |
650 /// Create new [KernelDriver] instance and put it into the [driver] field. | 650 /// Create new [KernelDriver] instance and put it into the [driver] field. |
651 void _createDriver( | 651 void _createDriver( |
652 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { | 652 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { |
653 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); | 653 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); |
654 var uriTranslator = | 654 var uriTranslator = |
655 new UriTranslatorImpl(dartLibraries, {}, new MapPackages(packages)); | 655 new UriTranslatorImpl(dartLibraries, {}, new MapPackages(packages)); |
656 driver = new KernelDriver( | 656 driver = new KernelDriver( |
657 new PerformanceLog(null), | |
658 fileSystem, | |
659 new MemoryByteStore(), | |
660 uriTranslator, | |
661 new ProcessedOptions(new CompilerOptions() | 657 new ProcessedOptions(new CompilerOptions() |
| 658 ..logger = new PerformanceLog(null) |
| 659 ..fileSystem = fileSystem |
| 660 ..byteStore = new MemoryByteStore() |
662 ..strongMode = true | 661 ..strongMode = true |
663 ..target = new NoneTarget(new TargetFlags(strongMode: true))), | 662 ..target = new NoneTarget(new TargetFlags(strongMode: true))), |
| 663 uriTranslator, |
664 fileAddedFn: fileAddedFn); | 664 fileAddedFn: fileAddedFn); |
665 } | 665 } |
666 | 666 |
667 Library _getLibrary(KernelResult result, Uri uri) { | 667 Library _getLibrary(KernelResult result, Uri uri) { |
668 for (var cycleResult in result.results) { | 668 for (var cycleResult in result.results) { |
669 for (var library in cycleResult.kernelLibraries) { | 669 for (var library in cycleResult.kernelLibraries) { |
670 if (library.importUri == uri) return library; | 670 if (library.importUri == uri) return library; |
671 } | 671 } |
672 } | 672 } |
673 throw fail('No library found with URI "$uri"'); | 673 throw fail('No library found with URI "$uri"'); |
(...skipping 12 matching lines...) Expand all Loading... |
686 .writeLibraryFile(library); | 686 .writeLibraryFile(library); |
687 return buffer.toString(); | 687 return buffer.toString(); |
688 } | 688 } |
689 | 689 |
690 /// Return the [Uri] for the given Posix [path]. | 690 /// Return the [Uri] for the given Posix [path]. |
691 static Uri _folderUri(String path) { | 691 static Uri _folderUri(String path) { |
692 if (!path.endsWith('/')) path += '/'; | 692 if (!path.endsWith('/')) path += '/'; |
693 return Uri.parse('file://$path'); | 693 return Uri.parse('file://$path'); |
694 } | 694 } |
695 } | 695 } |
OLD | NEW |