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

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

Issue 2970273004: Deprecate all diagnostics methods that use strings. (Closed)
Patch Set: Merged with 4df146dd9a465d63344330bf3e45524b927c92ec 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 | « pkg/front_end/lib/src/fasta/quote.dart ('k') | pkg/front_end/lib/src/fasta/scope.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 library fasta.run; 5 library fasta.run;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show stdout, exit, exitCode; 9 import 'dart:io' show stdout, exit, exitCode;
10 10
11 import 'package:testing/testing.dart' show StdioProcess; 11 import 'package:testing/testing.dart' show StdioProcess;
12 12
13 import 'testing/patched_sdk_location.dart' 13 import 'testing/patched_sdk_location.dart'
14 show computeDartVm, computePatchedSdk; 14 show computeDartVm, computePatchedSdk;
15 15
16 import 'compiler_context.dart' show CompilerContext; 16 import 'compiler_context.dart' show CompilerContext;
17 17
18 import 'compiler_command_line.dart' show CompilerCommandLine; 18 import 'compiler_command_line.dart' show CompilerCommandLine;
19 19
20 import 'fasta.dart' show CompileTask; 20 import 'fasta.dart' show CompileTask;
21 21
22 import 'errors.dart' show InputError; 22 import 'deprecated_problems.dart' show deprecated_InputError;
23 23
24 import 'ticker.dart' show Ticker; 24 import 'ticker.dart' show Ticker;
25 25
26 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); 26 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
27 27
28 mainEntryPoint(List<String> arguments) async { 28 mainEntryPoint(List<String> arguments) async {
29 Uri uri; 29 Uri uri;
30 for (int i = 0; i < iterations; i++) { 30 for (int i = 0; i < iterations; i++) {
31 await CompilerCommandLine.withGlobalOptions("run", arguments, 31 await CompilerCommandLine.withGlobalOptions("run", arguments,
32 (CompilerContext c) async { 32 (CompilerContext c) async {
33 if (i > 0) { 33 if (i > 0) {
34 print("\n"); 34 print("\n");
35 } 35 }
36 try { 36 try {
37 CompileTask task = 37 CompileTask task =
38 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); 38 new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
39 uri = await task.compile(); 39 uri = await task.compile();
40 } on InputError catch (e) { 40 } on deprecated_InputError catch (e) {
41 print(e.format()); 41 print(e.deprecated_format());
42 exit(1); 42 exit(1);
43 } 43 }
44 if (exitCode != 0) exit(exitCode); 44 if (exitCode != 0) exit(exitCode);
45 if (i + 1 == iterations) { 45 if (i + 1 == iterations) {
46 exit(await run(uri, c)); 46 exit(await run(uri, c));
47 } 47 }
48 }); 48 });
49 } 49 }
50 } 50 }
51 51
52 Future<int> run(Uri uri, CompilerContext c) async { 52 Future<int> run(Uri uri, CompilerContext c) async {
53 Uri sdk = await computePatchedSdk(); 53 Uri sdk = await computePatchedSdk();
54 Uri dartVm = computeDartVm(sdk); 54 Uri dartVm = computeDartVm(sdk);
55 List<String> arguments = <String>["${uri.toFilePath()}"] 55 List<String> arguments = <String>["${uri.toFilePath()}"]
56 ..addAll(c.options.arguments.skip(1)); 56 ..addAll(c.options.arguments.skip(1));
57 if (c.options.verbose) { 57 if (c.options.verbose) {
58 print("Running ${dartVm.toFilePath()} ${arguments.join(' ')}"); 58 print("Running ${dartVm.toFilePath()} ${arguments.join(' ')}");
59 } 59 }
60 StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), arguments); 60 StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), arguments);
61 stdout.write(result.output); 61 stdout.write(result.output);
62 return result.exitCode; 62 return result.exitCode;
63 } 63 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/quote.dart ('k') | pkg/front_end/lib/src/fasta/scope.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698