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

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

Issue 2886233002: Remove 'dumpIr' from writeProgram() and KernelTarget. (Closed)
Patch Set: Created 3 years, 7 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) 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta; 5 library fasta;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:convert' show JSON; 9 import 'dart:convert' show JSON;
10 10
11 import 'dart:io' show BytesBuilder, Directory, File, exitCode; 11 import 'dart:io' show BytesBuilder, Directory, File, exitCode;
12 12
13 import 'package:front_end/file_system.dart'; 13 import 'package:front_end/file_system.dart';
14 import 'package:front_end/physical_file_system.dart'; 14 import 'package:front_end/physical_file_system.dart';
15 import 'package:front_end/src/fasta/kernel/utils.dart';
15 import 'package:kernel/binary/ast_to_binary.dart' 16 import 'package:kernel/binary/ast_to_binary.dart'
16 show LibraryFilteringBinaryPrinter; 17 show LibraryFilteringBinaryPrinter;
17 18
18 import 'package:kernel/kernel.dart' show Library, Program, loadProgramFromBytes; 19 import 'package:kernel/kernel.dart' show Library, Program, loadProgramFromBytes;
19 20
20 import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget; 21 import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
21 22
22 import 'compiler_command_line.dart' show CompilerCommandLine; 23 import 'compiler_command_line.dart' show CompilerCommandLine;
23 24
24 import 'compiler_context.dart' show CompilerContext; 25 import 'compiler_context.dart' show CompilerContext;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 139 }
139 String argument = c.options.arguments.first; 140 String argument = c.options.arguments.first;
140 Uri uri = Uri.base.resolve(argument); 141 Uri uri = Uri.base.resolve(argument);
141 String path = uriTranslator.translate(uri)?.path ?? argument; 142 String path = uriTranslator.translate(uri)?.path ?? argument;
142 if (path.endsWith(".dart")) { 143 if (path.endsWith(".dart")) {
143 kernelTarget.read(uri); 144 kernelTarget.read(uri);
144 } else { 145 } else {
145 inputError(uri, -1, "Unexpected input: $uri"); 146 inputError(uri, -1, "Unexpected input: $uri");
146 } 147 }
147 await dillTarget.buildOutlines(); 148 await dillTarget.buildOutlines();
148 await kernelTarget.buildOutlines(); 149 var outline = await kernelTarget.buildOutlines();
150 if (c.options.dumpIr && output != null) {
151 printProgramText(outline);
152 }
149 await kernelTarget.writeOutline(output); 153 await kernelTarget.writeOutline(output);
150 if (c.options.dumpIr && output != null) {
151 kernelTarget.dumpIr();
152 }
153 return kernelTarget; 154 return kernelTarget;
154 } 155 }
155 156
156 Future<Uri> compile() async { 157 Future<Uri> compile() async {
157 KernelTarget kernelTarget = await buildOutline(); 158 KernelTarget kernelTarget = await buildOutline();
158 if (exitCode != 0) return null; 159 if (exitCode != 0) return null;
159 Uri uri = c.options.output; 160 Uri uri = c.options.output;
160 await kernelTarget.buildProgram(); 161 var program = await kernelTarget.buildProgram();
161 await kernelTarget.writeProgram(uri, 162 if (c.options.dumpIr) printProgramText(program);
162 dumpIr: c.options.dumpIr, verify: c.options.verify); 163 await kernelTarget.writeProgram(uri, verify: c.options.verify);
163 return uri; 164 return uri;
164 } 165 }
165 } 166 }
166 167
167 Future<CompilationResult> parseScript( 168 Future<CompilationResult> parseScript(
168 Uri fileName, Uri packages, Uri patchedSdk, 169 Uri fileName, Uri packages, Uri patchedSdk,
169 {bool verbose: false, bool strongMode: false}) async { 170 {bool verbose: false, bool strongMode: false}) async {
170 return parseScriptInFileSystem( 171 return parseScriptInFileSystem(
171 fileName, PhysicalFileSystem.instance, packages, patchedSdk, 172 fileName, PhysicalFileSystem.instance, packages, patchedSdk,
172 verbose: verbose, strongMode: strongMode); 173 verbose: verbose, strongMode: strongMode);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 final BytesBuilder builder = new BytesBuilder(); 290 final BytesBuilder builder = new BytesBuilder();
290 291
291 void add(List<int> data) { 292 void add(List<int> data) {
292 builder.add(data); 293 builder.add(data);
293 } 294 }
294 295
295 void close() { 296 void close() {
296 // Nothing to do. 297 // Nothing to do.
297 } 298 }
298 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698