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

Side by Side Diff: pkg/front_end/tool/example.dart

Issue 2614063007: Use URIs rather than paths in front end API. (Closed)
Patch Set: Run dartfmt Created 3 years, 11 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 import 'dart:async'; 1 import 'dart:async';
2 2
3 import 'package:front_end/kernel_generator.dart'; 3 import 'package:front_end/kernel_generator.dart';
4 import 'package:front_end/compiler_options.dart'; 4 import 'package:front_end/compiler_options.dart';
5 import 'package:kernel/binary/ast_to_binary.dart'; 5 import 'package:kernel/binary/ast_to_binary.dart';
6 import 'package:kernel/kernel.dart' show Program; 6 import 'package:kernel/kernel.dart' show Program;
7 7
8 Future dumpToSink(Program program, StreamSink<List<int>> sink) { 8 Future dumpToSink(Program program, StreamSink<List<int>> sink) {
9 new BinaryPrinter(sink).writeProgramFile(program); 9 new BinaryPrinter(sink).writeProgramFile(program);
10 return sink.close(); 10 return sink.close();
11 } 11 }
12 12
13 Future kernelToSink(Uri entry, StreamSink<List<int>> sink) async { 13 Future kernelToSink(Uri entry, StreamSink<List<int>> sink) async {
14 var program = await kernelForProgram(entry, 14 var program = await kernelForProgram(
15 entry,
15 new CompilerOptions() 16 new CompilerOptions()
16 ..sdkPath = 'sdk' 17 ..sdkRoot = new Uri.file('sdk')
17 ..packagesFilePath = '.packages' 18 ..packagesFileUri = new Uri.file('.packages')
18 ..onError = (e) => print(e.message)); 19 ..onError = (e) => print(e.message));
19 20
20 await dumpToSink(program, sink); 21 await dumpToSink(program, sink);
21 } 22 }
22 23
23 main(args) async { 24 main(args) async {
24 kernelToSink(Uri.base.resolve(args[0]), 25 kernelToSink(
26 Uri.base.resolve(args[0]),
25 // TODO(sigmund,hausner): define memory type where to dump binary data. 27 // TODO(sigmund,hausner): define memory type where to dump binary data.
26 new StreamController<List<int>>.broadcast().sink); 28 new StreamController<List<int>>.broadcast().sink);
27 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698