| 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 library analyzer.test.src.summary.resynthesize_kernel_test; | 5 library analyzer.test.src.summary.resynthesize_kernel_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 11 import 'package:analyzer/src/dart/element/element.dart'; | 11 import 'package:analyzer/src/dart/element/element.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 import 'package:analyzer/src/kernel/resynthesize.dart'; | 13 import 'package:analyzer/src/kernel/resynthesize.dart'; |
| 14 import 'package:analyzer/src/summary/resynthesize.dart'; | 14 import 'package:analyzer/src/summary/resynthesize.dart'; |
| 15 import 'package:front_end/compiler_options.dart'; | 15 import 'package:front_end/compiler_options.dart'; |
| 16 import 'package:front_end/file_system.dart'; | 16 import 'package:front_end/file_system.dart'; |
| 17 import 'package:front_end/src/base/performace_logger.dart'; | 17 import 'package:front_end/src/base/performace_logger.dart'; |
| 18 import 'package:front_end/src/base/libraries_specification.dart'; | |
| 19 import 'package:front_end/src/base/processed_options.dart'; | 18 import 'package:front_end/src/base/processed_options.dart'; |
| 20 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 19 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
| 21 import 'package:front_end/src/incremental/byte_store.dart'; | 20 import 'package:front_end/src/incremental/byte_store.dart'; |
| 22 import 'package:front_end/src/incremental/kernel_driver.dart'; | 21 import 'package:front_end/src/incremental/kernel_driver.dart'; |
| 23 import 'package:kernel/kernel.dart' as kernel; | 22 import 'package:kernel/kernel.dart' as kernel; |
| 24 import 'package:kernel/target/targets.dart'; | 23 import 'package:kernel/target/targets.dart'; |
| 25 import 'package:kernel/text/ast_to_text.dart' as kernel; | 24 import 'package:kernel/text/ast_to_text.dart' as kernel; |
| 26 import 'package:kernel/type_environment.dart' as kernel; | 25 import 'package:kernel/type_environment.dart' as kernel; |
| 27 import 'package:package_config/packages.dart'; | 26 import 'package:package_config/packages.dart'; |
| 28 import 'package:path/path.dart' as pathos; | 27 import 'package:path/path.dart' as pathos; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 67 |
| 69 @override | 68 @override |
| 70 Future<LibraryElementImpl> checkLibrary(String text, | 69 Future<LibraryElementImpl> checkLibrary(String text, |
| 71 {bool allowErrors: false, bool dumpSummaries: false}) async { | 70 {bool allowErrors: false, bool dumpSummaries: false}) async { |
| 72 new MockSdk(resourceProvider: resourceProvider); | 71 new MockSdk(resourceProvider: resourceProvider); |
| 73 | 72 |
| 74 File testFile = resourceProvider.newFile('/test.dart', text); | 73 File testFile = resourceProvider.newFile('/test.dart', text); |
| 75 Uri testUri = testFile.toUri(); | 74 Uri testUri = testFile.toUri(); |
| 76 String testUriStr = testUri.toString(); | 75 String testUriStr = testUri.toString(); |
| 77 | 76 |
| 78 Map<String, LibraryInfo> dartLibraries = {}; | 77 Map<String, Uri> dartLibraries = {}; |
| 79 MockSdk.FULL_URI_MAP.forEach((dartUri, path) { | 78 MockSdk.FULL_URI_MAP.forEach((dartUri, path) { |
| 80 var name = Uri.parse(dartUri).path; | 79 dartLibraries[Uri.parse(dartUri).path] = Uri.parse('file://$path'); |
| 81 dartLibraries[name] = | |
| 82 new LibraryInfo(name, Uri.parse('file://$path'), const []); | |
| 83 }); | 80 }); |
| 84 | 81 |
| 85 var uriTranslator = new UriTranslatorImpl( | 82 var uriTranslator = |
| 86 new TargetLibrariesSpecification('none', dartLibraries), | 83 new UriTranslatorImpl(dartLibraries, {}, Packages.noPackages); |
| 87 Packages.noPackages); | |
| 88 var options = new ProcessedOptions(new CompilerOptions() | 84 var options = new ProcessedOptions(new CompilerOptions() |
| 89 ..target = new NoneTarget(new TargetFlags(strongMode: isStrongMode)) | 85 ..target = new NoneTarget(new TargetFlags(strongMode: isStrongMode)) |
| 90 ..reportMessages = false | 86 ..reportMessages = false |
| 91 ..logger = new PerformanceLog(null) | 87 ..logger = new PerformanceLog(null) |
| 92 ..fileSystem = new _FileSystemAdaptor(resourceProvider) | 88 ..fileSystem = new _FileSystemAdaptor(resourceProvider) |
| 93 ..byteStore = new MemoryByteStore()); | 89 ..byteStore = new MemoryByteStore()); |
| 94 var driver = new KernelDriver(options, uriTranslator); | 90 var driver = new KernelDriver(options, uriTranslator); |
| 95 | 91 |
| 96 KernelResult kernelResult = await driver.getKernel(testUri); | 92 KernelResult kernelResult = await driver.getKernel(testUri); |
| 97 | 93 |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 @override | 947 @override |
| 952 Future<List<int>> readAsBytes() async { | 948 Future<List<int>> readAsBytes() async { |
| 953 return file.readAsBytesSync(); | 949 return file.readAsBytesSync(); |
| 954 } | 950 } |
| 955 | 951 |
| 956 @override | 952 @override |
| 957 Future<String> readAsString() async { | 953 Future<String> readAsString() async { |
| 958 return file.readAsStringSync(); | 954 return file.readAsStringSync(); |
| 959 } | 955 } |
| 960 } | 956 } |
| OLD | NEW |