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

Side by Side Diff: pkg/front_end/lib/src/base/processed_options.dart

Issue 2980273002: Random improvements in error reporting. (Closed)
Patch Set: rebased 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/front_end/lib/src/fasta/fasta_codes_generated.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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/compilation_message.dart'; 7 import 'package:front_end/compilation_message.dart';
8 import 'package:front_end/compiler_options.dart'; 8 import 'package:front_end/compiler_options.dart';
9 import 'package:front_end/file_system.dart'; 9 import 'package:front_end/file_system.dart';
10 import 'package:front_end/src/base/performace_logger.dart'; 10 import 'package:front_end/src/base/performace_logger.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 for (var source in inputs) { 166 for (var source in inputs) {
167 // Note: we don't translate Uris at this point because some of the 167 // Note: we don't translate Uris at this point because some of the
168 // validation further below must be done before we even construct an 168 // validation further below must be done before we even construct an
169 // UriTranslator 169 // UriTranslator
170 // TODO(sigmund): consider validating dart/packages uri right after we 170 // TODO(sigmund): consider validating dart/packages uri right after we
171 // build the uri translator. 171 // build the uri translator.
172 if (source.scheme != 'dart' && 172 if (source.scheme != 'dart' &&
173 source.scheme != 'packages' && 173 source.scheme != 'packages' &&
174 !await fileSystem.entityForUri(source).exists()) { 174 !await fileSystem.entityForUri(source).exists()) {
175 reportWithoutLocation( 175 reportWithoutLocation(
176 templateInputFileNotFound.withArguments('$source'), Severity.error); 176 templateInputFileNotFound.withArguments(source), Severity.error);
177 return false; 177 return false;
178 } 178 }
179 } 179 }
180 180
181 if (_raw.sdkRoot != null && 181 if (_raw.sdkRoot != null &&
182 !await fileSystem.entityForUri(sdkRoot).exists()) { 182 !await fileSystem.entityForUri(sdkRoot).exists()) {
183 reportWithoutLocation( 183 reportWithoutLocation(
184 templateSdkRootNotFound.withArguments('$sdkRoot'), Severity.error); 184 templateSdkRootNotFound.withArguments(sdkRoot), Severity.error);
185 return false; 185 return false;
186 } 186 }
187 187
188 var summary = sdkSummary; 188 var summary = sdkSummary;
189 if (summary != null && !await fileSystem.entityForUri(summary).exists()) { 189 if (summary != null && !await fileSystem.entityForUri(summary).exists()) {
190 reportWithoutLocation( 190 reportWithoutLocation(
191 templateSdkSummaryNotFound.withArguments('$summary'), Severity.error); 191 templateSdkSummaryNotFound.withArguments(summary), Severity.error);
192 return false; 192 return false;
193 } 193 }
194 194
195 if (compileSdk && summary != null) { 195 if (compileSdk && summary != null) {
196 reportWithoutLocation( 196 reportWithoutLocation(
197 templateInternalProblemUnsupported.withArguments( 197 messageInternalProblemProvidedBothCompileSdkAndSdkSummary,
198 "The compileSdk and sdkSummary options are mutually exclusive"),
199 Severity.internalProblem); 198 Severity.internalProblem);
200 return false; 199 return false;
201 } 200 }
202 return true; 201 return true;
203 } 202 }
204 203
205 /// Determine whether to generate code for the SDK when compiling a 204 /// Determine whether to generate code for the SDK when compiling a
206 /// whole-program. 205 /// whole-program.
207 bool get compileSdk => _raw.compileSdk; 206 bool get compileSdk => _raw.compileSdk;
208 207
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 399 }
401 400
402 /// Get the location of the SDK. 401 /// Get the location of the SDK.
403 Uri _normalizeSdkRoot() { 402 Uri _normalizeSdkRoot() {
404 // If an SDK summary location was provided, the SDK itself should not be 403 // If an SDK summary location was provided, the SDK itself should not be
405 // needed. 404 // needed.
406 assert(_raw.sdkSummary == null); 405 assert(_raw.sdkSummary == null);
407 if (_raw.sdkRoot == null) { 406 if (_raw.sdkRoot == null) {
408 // TODO(paulberry): implement the algorithm for finding the SDK 407 // TODO(paulberry): implement the algorithm for finding the SDK
409 // automagically. 408 // automagically.
410 return unimplemented('infer the default sdk location'); 409 return unimplemented('infer the default sdk location', -1, null);
411 } 410 }
412 var root = _raw.sdkRoot; 411 var root = _raw.sdkRoot;
413 if (!root.path.endsWith('/')) { 412 if (!root.path.endsWith('/')) {
414 root = root.replace(path: root.path + '/'); 413 root = root.replace(path: root.path + '/');
415 } 414 }
416 return root; 415 return root;
417 } 416 }
418 417
419 /// Get or infer the location of the SDK summary. 418 /// Get or infer the location of the SDK summary.
420 Uri _computeSdkSummaryUri() { 419 Uri _computeSdkSummaryUri() {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 String get dart2jsCode => _original.code.dart2jsCode; 551 String get dart2jsCode => _original.code.dart2jsCode;
553 552
554 SourceSpan get span => 553 SourceSpan get span =>
555 new SourceLocation(_original.charOffset, sourceUrl: _original.uri) 554 new SourceLocation(_original.charOffset, sourceUrl: _original.uri)
556 .pointSpan(); 555 .pointSpan();
557 556
558 _CompilationMessage(this._original, this.severity); 557 _CompilationMessage(this._original, this.severity);
559 558
560 String toString() => message; 559 String toString() => message;
561 } 560 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/fasta_codes_generated.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698