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

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

Issue 2981813002: Move `reify` to use fasta instead of dartk (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | pkg/kernel/test/closures/suite.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file 5 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file
6 // when closure_conversion is merged with master. 6 // when closure_conversion is merged with master.
7 7
8 library fasta.testing.kernel_chain; 8 library fasta.testing.kernel_chain;
9 9
10 import 'dart:async' show Future; 10 import 'dart:async' show Future;
11 11
12 import 'dart:io' show Directory, File, IOSink; 12 import 'dart:io' show Directory, File, IOSink;
13 13
14 import 'dart:typed_data' show Uint8List; 14 import 'dart:typed_data' show Uint8List;
15 15
16 import 'package:kernel/kernel.dart' show loadProgramFromBinary; 16 import 'package:kernel/kernel.dart' show loadProgramFromBinary;
17 17
18 import 'package:kernel/target/targets.dart' show Target;
19
18 import 'package:kernel/text/ast_to_text.dart' show Printer; 20 import 'package:kernel/text/ast_to_text.dart' show Printer;
19 21
20 import 'package:testing/testing.dart' show Result, StdioProcess, Step; 22 import 'package:testing/testing.dart' show Result, StdioProcess, Step;
21 23
22 import 'package:kernel/ast.dart' show Library, Program; 24 import 'package:kernel/ast.dart' show Library, Program;
23 25
24 import '../kernel/verifier.dart' show verifyProgram; 26 import '../kernel/verifier.dart' show verifyProgram;
25 27
26 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter; 28 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
27 29
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 String get name => "fasta compilation"; 187 String get name => "fasta compilation";
186 188
187 Future<Result<Program>> run( 189 Future<Result<Program>> run(
188 TestDescription description, CompileContext context) async { 190 TestDescription description, CompileContext context) async {
189 Result<Program> result; 191 Result<Program> result;
190 reportError(CompilationError error) { 192 reportError(CompilationError error) {
191 result ??= fail(null, error.message); 193 result ??= fail(null, error.message);
192 } 194 }
193 195
194 Uri sdk = await computePatchedSdk(); 196 Uri sdk = await computePatchedSdk();
195 Program p = await kernelForProgram( 197 var options = new CompilerOptions()
196 description.uri, 198 ..sdkRoot = sdk
197 new CompilerOptions() 199 ..compileSdk = true
198 ..sdkRoot = sdk 200 ..packagesFileUri = Uri.base.resolve('.packages')
199 ..packagesFileUri = Uri.base.resolve('.packages') 201 ..strongMode = context.strongMode
200 ..strongMode = context.strongMode 202 ..onError = reportError;
201 ..linkedDependencies = [sdk.resolve('platform.dill')] 203 if (context.target != null) {
202 ..onError = reportError); 204 options.target = context.target;
205 // Do not link platform.dill, but recompile the platform libraries. This
Siggi Cherem (dart-lang) 2017/07/13 22:22:29 BTW - I want to change that about how we include s
206 // ensures that if target defines extra libraries that those get included
207 // too.
208 } else {
209 options.linkedDependencies = [sdk.resolve('platform.dill')];
210 }
211 Program p = await kernelForProgram(description.uri, options);
203 return result ??= pass(p); 212 return result ??= pass(p);
204 } 213 }
205 } 214 }
206 215
207 abstract class CompileContext implements ChainContext { 216 abstract class CompileContext implements ChainContext {
208 bool get strongMode; 217 bool get strongMode;
218 Target get target;
209 } 219 }
210 220
211 class BytesCollector implements Sink<List<int>> { 221 class BytesCollector implements Sink<List<int>> {
212 final List<List<int>> lists = <List<int>>[]; 222 final List<List<int>> lists = <List<int>>[];
213 223
214 int length = 0; 224 int length = 0;
215 225
216 void add(List<int> data) { 226 void add(List<int> data) {
217 lists.add(data); 227 lists.add(data);
218 length += data.length; 228 length += data.length;
(...skipping 22 matching lines...) Expand all
241 251
242 Future openWrite(Uri uri, f(IOSink sink)) async { 252 Future openWrite(Uri uri, f(IOSink sink)) async {
243 IOSink sink = new File.fromUri(uri).openWrite(); 253 IOSink sink = new File.fromUri(uri).openWrite();
244 try { 254 try {
245 await f(sink); 255 await f(sink);
246 } finally { 256 } finally {
247 await sink.close(); 257 await sink.close();
248 } 258 }
249 print("Wrote $uri"); 259 print("Wrote $uri");
250 } 260 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/test/closures/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698