Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: pkg/front_end/test/src/incremental/kernel_driver_test.dart

Issue 2992773002: Kernel driver: pass options and use it for its compiler context (Closed)
Patch Set: v1 Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory_file_system.dart'; 8 import 'package:front_end/memory_file_system.dart';
8 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';
9 import 'package:front_end/src/fasta/kernel/utils.dart'; 11 import 'package:front_end/src/fasta/kernel/utils.dart';
10 import 'package:front_end/src/fasta/uri_translator_impl.dart'; 12 import 'package:front_end/src/fasta/uri_translator_impl.dart';
11 import 'package:front_end/src/incremental/byte_store.dart'; 13 import 'package:front_end/src/incremental/byte_store.dart';
12 import 'package:front_end/src/incremental/kernel_driver.dart'; 14 import 'package:front_end/src/incremental/kernel_driver.dart';
13 import 'package:kernel/ast.dart'; 15 import 'package:kernel/ast.dart';
14 import 'package:kernel/binary/ast_from_binary.dart'; 16 import 'package:kernel/binary/ast_from_binary.dart';
15 import 'package:kernel/target/targets.dart'; 17 import 'package:kernel/target/targets.dart';
16 import 'package:kernel/text/ast_to_text.dart'; 18 import 'package:kernel/text/ast_to_text.dart';
17 import 'package:kernel/verifier.dart'; 19 import 'package:kernel/verifier.dart';
18 import 'package:package_config/src/packages_impl.dart'; 20 import 'package:package_config/src/packages_impl.dart';
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 void _createDriver( 651 void _createDriver(
650 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) { 652 {Map<String, Uri> packages, KernelDriverFileAddedFn fileAddedFn}) {
651 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); 653 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem);
652 var uriTranslator = 654 var uriTranslator =
653 new UriTranslatorImpl(dartLibraries, {}, new MapPackages(packages)); 655 new UriTranslatorImpl(dartLibraries, {}, new MapPackages(packages));
654 driver = new KernelDriver( 656 driver = new KernelDriver(
655 new PerformanceLog(null), 657 new PerformanceLog(null),
656 fileSystem, 658 fileSystem,
657 new MemoryByteStore(), 659 new MemoryByteStore(),
658 uriTranslator, 660 uriTranslator,
659 new NoneTarget(new TargetFlags(strongMode: true)), 661 new ProcessedOptions(new CompilerOptions()
662 ..strongMode = true
663 ..target = new NoneTarget(new TargetFlags(strongMode: true))),
660 fileAddedFn: fileAddedFn); 664 fileAddedFn: fileAddedFn);
661 } 665 }
662 666
663 Library _getLibrary(KernelResult result, Uri uri) { 667 Library _getLibrary(KernelResult result, Uri uri) {
664 for (var cycleResult in result.results) { 668 for (var cycleResult in result.results) {
665 for (var library in cycleResult.kernelLibraries) { 669 for (var library in cycleResult.kernelLibraries) {
666 if (library.importUri == uri) return library; 670 if (library.importUri == uri) return library;
667 } 671 }
668 } 672 }
669 throw fail('No library found with URI "$uri"'); 673 throw fail('No library found with URI "$uri"');
(...skipping 12 matching lines...) Expand all
682 .writeLibraryFile(library); 686 .writeLibraryFile(library);
683 return buffer.toString(); 687 return buffer.toString();
684 } 688 }
685 689
686 /// Return the [Uri] for the given Posix [path]. 690 /// Return the [Uri] for the given Posix [path].
687 static Uri _folderUri(String path) { 691 static Uri _folderUri(String path) {
688 if (!path.endsWith('/')) path += '/'; 692 if (!path.endsWith('/')) path += '/';
689 return Uri.parse('file://$path'); 693 return Uri.parse('file://$path');
690 } 694 }
691 } 695 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698