| 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/memory_file_system.dart'; | 7 import 'package:front_end/memory_file_system.dart'; |
| 8 import 'package:front_end/src/base/performace_logger.dart'; | 8 import 'package:front_end/src/base/performace_logger.dart'; |
| 9 import 'package:front_end/src/fasta/kernel/utils.dart'; | 9 import 'package:front_end/src/fasta/kernel/utils.dart'; |
| 10 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 10 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
| 11 import 'package:front_end/src/incremental/byte_store.dart'; | 11 import 'package:front_end/src/incremental/byte_store.dart'; |
| 12 import 'package:front_end/src/incremental/kernel_driver.dart'; | 12 import 'package:front_end/src/incremental/kernel_driver.dart'; |
| 13 import 'package:kernel/ast.dart'; | 13 import 'package:kernel/ast.dart'; |
| 14 import 'package:kernel/binary/ast_from_binary.dart'; | 14 import 'package:kernel/binary/ast_from_binary.dart'; |
| 15 import 'package:kernel/target/targets.dart'; |
| 15 import 'package:kernel/text/ast_to_text.dart'; | 16 import 'package:kernel/text/ast_to_text.dart'; |
| 16 import 'package:kernel/verifier.dart'; | 17 import 'package:kernel/verifier.dart'; |
| 17 import 'package:test/test.dart'; | 18 import 'package:test/test.dart'; |
| 18 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 19 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 19 | 20 |
| 20 import 'mock_sdk.dart'; | 21 import 'mock_sdk.dart'; |
| 21 | 22 |
| 22 main() { | 23 main() { |
| 23 defineReflectiveSuite(() { | 24 defineReflectiveSuite(() { |
| 24 defineReflectiveTests(KernelDriverTest); | 25 defineReflectiveTests(KernelDriverTest); |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 for (var shouldExclude in excludes) { | 661 for (var shouldExclude in excludes) { |
| 661 expect(libraryUris, isNot(contains(shouldExclude))); | 662 expect(libraryUris, isNot(contains(shouldExclude))); |
| 662 } | 663 } |
| 663 } | 664 } |
| 664 | 665 |
| 665 /// Create new [KernelDriver] instance and put it into the [driver] field. | 666 /// Create new [KernelDriver] instance and put it into the [driver] field. |
| 666 void _createDriver( | 667 void _createDriver( |
| 667 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { | 668 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { |
| 668 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); | 669 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); |
| 669 var uriTranslator = new UriTranslatorImpl(dartLibraries, {}, packages); | 670 var uriTranslator = new UriTranslatorImpl(dartLibraries, {}, packages); |
| 670 driver = new KernelDriver(new PerformanceLog(null), fileSystem, | 671 driver = new KernelDriver( |
| 671 new MemoryByteStore(), uriTranslator, true, | 672 new PerformanceLog(null), |
| 673 fileSystem, |
| 674 new MemoryByteStore(), |
| 675 uriTranslator, |
| 676 new NoneTarget(new TargetFlags(strongMode: true)), |
| 672 fileAddedFn: fileAddedFn); | 677 fileAddedFn: fileAddedFn); |
| 673 } | 678 } |
| 674 | 679 |
| 675 Library _getLibrary(KernelResult result, Uri uri) { | 680 Library _getLibrary(KernelResult result, Uri uri) { |
| 676 for (var cycleResult in result.results) { | 681 for (var cycleResult in result.results) { |
| 677 for (var library in cycleResult.kernelLibraries) { | 682 for (var library in cycleResult.kernelLibraries) { |
| 678 if (library.importUri == uri) return library; | 683 if (library.importUri == uri) return library; |
| 679 } | 684 } |
| 680 } | 685 } |
| 681 throw fail('No library found with URI "$uri"'); | 686 throw fail('No library found with URI "$uri"'); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 694 .writeLibraryFile(library); | 699 .writeLibraryFile(library); |
| 695 return buffer.toString(); | 700 return buffer.toString(); |
| 696 } | 701 } |
| 697 | 702 |
| 698 /// Return the [Uri] for the given Posix [path]. | 703 /// Return the [Uri] for the given Posix [path]. |
| 699 static Uri _folderUri(String path) { | 704 static Uri _folderUri(String path) { |
| 700 if (!path.endsWith('/')) path += '/'; | 705 if (!path.endsWith('/')) path += '/'; |
| 701 return Uri.parse('file://$path'); | 706 return Uri.parse('file://$path'); |
| 702 } | 707 } |
| 703 } | 708 } |
| OLD | NEW |