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_spec.dart'; | |
18 import 'package:front_end/src/base/processed_options.dart'; | 19 import 'package:front_end/src/base/processed_options.dart'; |
19 import 'package:front_end/src/fasta/uri_translator_impl.dart'; | 20 import 'package:front_end/src/fasta/uri_translator_impl.dart'; |
20 import 'package:front_end/src/incremental/byte_store.dart'; | 21 import 'package:front_end/src/incremental/byte_store.dart'; |
21 import 'package:front_end/src/incremental/kernel_driver.dart'; | 22 import 'package:front_end/src/incremental/kernel_driver.dart'; |
22 import 'package:kernel/kernel.dart' as kernel; | 23 import 'package:kernel/kernel.dart' as kernel; |
23 import 'package:kernel/target/targets.dart'; | 24 import 'package:kernel/target/targets.dart'; |
24 import 'package:kernel/text/ast_to_text.dart' as kernel; | 25 import 'package:kernel/text/ast_to_text.dart' as kernel; |
25 import 'package:kernel/type_environment.dart' as kernel; | 26 import 'package:kernel/type_environment.dart' as kernel; |
26 import 'package:package_config/packages.dart'; | 27 import 'package:package_config/packages.dart'; |
27 import 'package:path/path.dart' as pathos; | 28 import 'package:path/path.dart' as pathos; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 | 68 |
68 @override | 69 @override |
69 Future<LibraryElementImpl> checkLibrary(String text, | 70 Future<LibraryElementImpl> checkLibrary(String text, |
70 {bool allowErrors: false, bool dumpSummaries: false}) async { | 71 {bool allowErrors: false, bool dumpSummaries: false}) async { |
71 new MockSdk(resourceProvider: resourceProvider); | 72 new MockSdk(resourceProvider: resourceProvider); |
72 | 73 |
73 File testFile = resourceProvider.newFile('/test.dart', text); | 74 File testFile = resourceProvider.newFile('/test.dart', text); |
74 Uri testUri = testFile.toUri(); | 75 Uri testUri = testFile.toUri(); |
75 String testUriStr = testUri.toString(); | 76 String testUriStr = testUri.toString(); |
76 | 77 |
77 Map<String, Uri> dartLibraries = {}; | 78 Map<String, LibraryInfo> dartLibraries = {}; |
78 MockSdk.FULL_URI_MAP.forEach((dartUri, path) { | 79 MockSdk.FULL_URI_MAP.forEach((dartUri, path) { |
79 dartLibraries[Uri.parse(dartUri).path] = Uri.parse('file://$path'); | 80 var name = Uri.parse(dartUri).path; |
81 dartLibraries[name] = | |
82 new LibraryInfo(name, Uri.parse('file://$path'), const []); | |
ahe
2017/08/03 11:58:15
This isn't a real file URI. Please don't use file
Siggi Cherem (dart-lang)
2017/08/05 00:41:01
Note: we are tracking doing so here: https://githu
| |
80 }); | 83 }); |
81 | 84 |
82 var uriTranslator = | 85 var uriTranslator = new UriTranslatorImpl( |
83 new UriTranslatorImpl(dartLibraries, {}, Packages.noPackages); | 86 new TargetLibrariesSpecification('none', dartLibraries), |
87 Packages.noPackages); | |
84 var options = new ProcessedOptions(new CompilerOptions() | 88 var options = new ProcessedOptions(new CompilerOptions() |
85 ..target = new NoneTarget(new TargetFlags(strongMode: isStrongMode)) | 89 ..target = new NoneTarget(new TargetFlags(strongMode: isStrongMode)) |
86 ..reportMessages = false | 90 ..reportMessages = false |
87 ..logger = new PerformanceLog(null) | 91 ..logger = new PerformanceLog(null) |
88 ..fileSystem = new _FileSystemAdaptor(resourceProvider) | 92 ..fileSystem = new _FileSystemAdaptor(resourceProvider) |
89 ..byteStore = new MemoryByteStore()); | 93 ..byteStore = new MemoryByteStore()); |
90 var driver = new KernelDriver(options, uriTranslator); | 94 var driver = new KernelDriver(options, uriTranslator); |
91 | 95 |
92 KernelResult kernelResult = await driver.getKernel(testUri); | 96 KernelResult kernelResult = await driver.getKernel(testUri); |
93 | 97 |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 @override | 1123 @override |
1120 Future<List<int>> readAsBytes() async { | 1124 Future<List<int>> readAsBytes() async { |
1121 return file.readAsBytesSync(); | 1125 return file.readAsBytesSync(); |
1122 } | 1126 } |
1123 | 1127 |
1124 @override | 1128 @override |
1125 Future<String> readAsString() async { | 1129 Future<String> readAsString() async { |
1126 return file.readAsStringSync(); | 1130 return file.readAsStringSync(); |
1127 } | 1131 } |
1128 } | 1132 } |
OLD | NEW |