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

Side by Side Diff: pkg/front_end/lib/src/fasta/vm.dart

Issue 2825063002: Move kernel baseline tests to front_end. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/suite.dart ('k') | pkg/front_end/test/fasta/accessors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// API for compiling Dart source code to .dill (Kernel IR) files. 5 /// API for compiling Dart source code to .dill (Kernel IR) files.
6 library front_end.vm; 6 library front_end.vm;
7 // TODO(ahe): Convert this file to use the API in `../../kernel_generator.dart` 7 // TODO(ahe): Convert this file to use the API in `../../kernel_generator.dart`
8 // and `../../compiler_options.dart`. 8 // and `../../compiler_options.dart`.
9 9
10 import 'dart:async' show Future; 10 import 'dart:async' show Future;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 factory CompilationResult.crash(Object exception, StackTrace stack) = 45 factory CompilationResult.crash(Object exception, StackTrace stack) =
46 _CompilationCrash; 46 _CompilationCrash;
47 47
48 Status get status; 48 Status get status;
49 49
50 get payload; 50 get payload;
51 51
52 List toResponse() => [status.index, payload]; 52 List toResponse() => [status.index, payload];
53 } 53 }
54 54
55 Future<CompilationResult> parseScript(Uri script, {bool verbose: false}) async { 55 Future<CompilationResult> parseScript(Uri script,
56 {bool verbose: false, bool strongMode: false}) async {
56 final Uri packagesUri = (Platform.packageConfig != null) 57 final Uri packagesUri = (Platform.packageConfig != null)
57 ? Uri.parse(Platform.packageConfig) 58 ? Uri.parse(Platform.packageConfig)
58 : await _findPackagesFile(script); 59 : await _findPackagesFile(script);
59 if (packagesUri == null) { 60 if (packagesUri == null) {
60 throw "Could not find .packages"; 61 throw "Could not find .packages";
61 } 62 }
62 63
63 final Uri patchedSdk = Uri.base 64 final Uri patchedSdk = Uri.base
64 .resolveUri(new Uri.file(Platform.resolvedExecutable)) 65 .resolveUri(new Uri.file(Platform.resolvedExecutable))
65 .resolveUri(new Uri.directory("patched_sdk")); 66 .resolveUri(new Uri.directory("patched_sdk"));
66 67
67 if (verbose) { 68 if (verbose) {
68 print("""DFE: Requesting compilation { 69 print("""DFE: Requesting compilation {
69 scriptUri: ${script} 70 scriptUri: ${script}
70 packagesUri: ${packagesUri} 71 packagesUri: ${packagesUri}
71 patchedSdk: ${patchedSdk} 72 patchedSdk: ${patchedSdk}
72 }"""); 73 }""");
73 } 74 }
74 75
75 try { 76 try {
76 return await fasta.parseScript(script, packagesUri, patchedSdk, verbose); 77 return await fasta.parseScript(script, packagesUri, patchedSdk,
78 verbose: verbose, strongMode: strongMode);
77 } catch (err, stack) { 79 } catch (err, stack) {
78 return new CompilationResult.crash(err, stack); 80 return new CompilationResult.crash(err, stack);
79 } 81 }
80 } 82 }
81 83
82 class _CompilationOk extends CompilationResult { 84 class _CompilationOk extends CompilationResult {
83 final Uint8List bytes; 85 final Uint8List bytes;
84 86
85 _CompilationOk(this.bytes) : super._(); 87 _CompilationOk(this.bytes) : super._();
86 88
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (await new File.fromUri(packagesFile).exists()) { 142 if (await new File.fromUri(packagesFile).exists()) {
141 return packagesFile; 143 return packagesFile;
142 } 144 }
143 if (dir.parent.path == dir.path) { 145 if (dir.parent.path == dir.path) {
144 break; 146 break;
145 } 147 }
146 dir = dir.parent; 148 dir = dir.parent;
147 } 149 }
148 return null; 150 return null;
149 } 151 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/suite.dart ('k') | pkg/front_end/test/fasta/accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698