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

Side by Side Diff: pkg/front_end/lib/src/fasta/fasta.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/errors.dart ('k') | pkg/front_end/lib/src/fasta/io.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 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, File, exitCode; 11 import 'dart:io' show BytesBuilder, File, exitCode;
12 12
13 import 'package:front_end/physical_file_system.dart'; 13 import 'package:front_end/physical_file_system.dart';
14 import 'package:front_end/src/fasta/kernel/utils.dart'; 14 import 'package:front_end/src/fasta/kernel/utils.dart';
15 15
16 import 'package:kernel/kernel.dart' show Program, loadProgramFromBytes; 16 import 'package:kernel/kernel.dart' show Program, loadProgramFromBytes;
17 17
18 import 'compiler_command_line.dart' show CompilerCommandLine; 18 import 'compiler_command_line.dart' show CompilerCommandLine;
19 19
20 import 'compiler_context.dart' show CompilerContext; 20 import 'compiler_context.dart' show CompilerContext;
21 21
22 import 'errors.dart' show InputError, inputError; 22 import 'deprecated_problems.dart'
23 show deprecated_InputError, deprecated_inputError;
23 24
24 import 'kernel/kernel_target.dart' show KernelTarget; 25 import 'kernel/kernel_target.dart' show KernelTarget;
25 26
26 import 'dill/dill_target.dart' show DillTarget; 27 import 'dill/dill_target.dart' show DillTarget;
27 28
28 import 'compile_platform.dart' show compilePlatformInternal; 29 import 'compile_platform.dart' show compilePlatformInternal;
29 30
30 import 'ticker.dart' show Ticker; 31 import 'ticker.dart' show Ticker;
31 32
32 import 'translate_uri.dart' show TranslateUri; 33 import 'translate_uri.dart' show TranslateUri;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 try { 69 try {
69 return await CompilerCommandLine.withGlobalOptions("outline", arguments, 70 return await CompilerCommandLine.withGlobalOptions("outline", arguments,
70 (CompilerContext c) async { 71 (CompilerContext c) async {
71 if (c.options.verbose) { 72 if (c.options.verbose) {
72 print("Building outlines for ${arguments.join(' ')}"); 73 print("Building outlines for ${arguments.join(' ')}");
73 } 74 }
74 CompileTask task = 75 CompileTask task =
75 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); 76 new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
76 return await task.buildOutline(c.options.output); 77 return await task.buildOutline(c.options.output);
77 }); 78 });
78 } on InputError catch (e) { 79 } on deprecated_InputError catch (e) {
79 exitCode = 1; 80 exitCode = 1;
80 print(e.format()); 81 print(e.deprecated_format());
81 return null; 82 return null;
82 } 83 }
83 } 84 }
84 85
85 Future<Uri> compile(List<String> arguments) async { 86 Future<Uri> compile(List<String> arguments) async {
86 try { 87 try {
87 return await CompilerCommandLine.withGlobalOptions("compile", arguments, 88 return await CompilerCommandLine.withGlobalOptions("compile", arguments,
88 (CompilerContext c) async { 89 (CompilerContext c) async {
89 if (c.options.verbose) { 90 if (c.options.verbose) {
90 print("Compiling directly to Kernel: ${arguments.join(' ')}"); 91 print("Compiling directly to Kernel: ${arguments.join(' ')}");
91 } 92 }
92 CompileTask task = 93 CompileTask task =
93 new CompileTask(c, new Ticker(isVerbose: c.options.verbose)); 94 new CompileTask(c, new Ticker(isVerbose: c.options.verbose));
94 return await task.compile(); 95 return await task.compile();
95 }); 96 });
96 } on InputError catch (e) { 97 } on deprecated_InputError catch (e) {
97 exitCode = 1; 98 exitCode = 1;
98 print(e.format()); 99 print(e.deprecated_format());
99 return null; 100 return null;
100 } 101 }
101 } 102 }
102 103
103 class CompileTask { 104 class CompileTask {
104 final CompilerContext c; 105 final CompilerContext c;
105 final Ticker ticker; 106 final Ticker ticker;
106 107
107 CompileTask(this.c, this.ticker); 108 CompileTask(this.c, this.ticker);
108 109
(...skipping 20 matching lines...) Expand all
129 Uri platform = c.options.platform; 130 Uri platform = c.options.platform;
130 if (platform != null) { 131 if (platform != null) {
131 _appendDillForUri(dillTarget, platform); 132 _appendDillForUri(dillTarget, platform);
132 } 133 }
133 String argument = c.options.arguments.first; 134 String argument = c.options.arguments.first;
134 Uri uri = Uri.base.resolve(argument); 135 Uri uri = Uri.base.resolve(argument);
135 String path = uriTranslator.translate(uri)?.path ?? argument; 136 String path = uriTranslator.translate(uri)?.path ?? argument;
136 if (path.endsWith(".dart")) { 137 if (path.endsWith(".dart")) {
137 kernelTarget.read(uri); 138 kernelTarget.read(uri);
138 } else { 139 } else {
139 inputError(uri, -1, "Unexpected input: $uri"); 140 deprecated_inputError(uri, -1, "Unexpected input: $uri");
140 } 141 }
141 await dillTarget.buildOutlines(); 142 await dillTarget.buildOutlines();
142 var outline = await kernelTarget.buildOutlines(); 143 var outline = await kernelTarget.buildOutlines();
143 if (c.options.dumpIr && output != null) { 144 if (c.options.dumpIr && output != null) {
144 printProgramText(outline, libraryFilter: kernelTarget.isSourceLibrary); 145 printProgramText(outline, libraryFilter: kernelTarget.isSourceLibrary);
145 } 146 }
146 if (output != null) { 147 if (output != null) {
147 await writeProgramToFile(outline, output); 148 await writeProgramToFile(outline, output);
148 ticker.logMs("Wrote outline to ${output.toFilePath()}"); 149 ticker.logMs("Wrote outline to ${output.toFilePath()}");
149 } 150 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 final BytesBuilder builder = new BytesBuilder(); 234 final BytesBuilder builder = new BytesBuilder();
234 235
235 void add(List<int> data) { 236 void add(List<int> data) {
236 builder.add(data); 237 builder.add(data);
237 } 238 }
238 239
239 void close() { 240 void close() {
240 // Nothing to do. 241 // Nothing to do.
241 } 242 }
242 } 243 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/errors.dart ('k') | pkg/front_end/lib/src/fasta/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698