Skip to content

Commit cd3fa6e

Browse files
stereotype441Commit Queue
authored andcommitted
[_fe_analyzer_shared] Use /// diagnostic comments in errors.dart.
There is no functional change. Change-Id: I6a6a6964ffd19de353c72472119f3836279000d3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466123 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 67d3a2c commit cd3fa6e

File tree

1 file changed

+53
-111
lines changed

1 file changed

+53
-111
lines changed

pkg/_fe_analyzer_shared/lib/src/base/errors.dart

Lines changed: 53 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -213,37 +213,27 @@ abstract class DiagnosticCode {
213213
/// Regular expression for identifying positional arguments in error messages.
214214
static final RegExp _positionalArgumentRegExp = new RegExp(r'\{(\d+)\}');
215215

216-
/**
217-
* The name of the error code.
218-
*/
216+
/// The name of the error code.
219217
final String name;
220218

221-
/**
222-
* The unique name of this error code.
223-
*/
219+
/// The unique name of this error code.
224220
final String uniqueName;
225221

226222
final String _problemMessage;
227223

228224
final String? _correctionMessage;
229225

230-
/**
231-
* Return `true` if diagnostics with this code have documentation for them
232-
* that has been published.
233-
*/
226+
/// Return `true` if diagnostics with this code have documentation for them
227+
/// that has been published.
234228
final bool hasPublishedDocs;
235229

236-
/**
237-
* Whether this error is caused by an unresolved identifier.
238-
*/
230+
/// Whether this error is caused by an unresolved identifier.
239231
final bool isUnresolvedIdentifier;
240232

241-
/**
242-
* Initialize a newly created error code to have the given [name]. The message
243-
* associated with the error will be created from the given [problemMessage]
244-
* template. The correction associated with the error will be created from the
245-
* given [correctionMessage] template.
246-
*/
233+
/// Initialize a newly created error code to have the given [name]. The
234+
/// message associated with the error will be created from the given
235+
/// [problemMessage] template. The correction associated with the error will
236+
/// be created from the given [correctionMessage] template.
247237
const DiagnosticCode({
248238
String? correctionMessage,
249239
this.hasPublishedDocs = false,
@@ -254,12 +244,10 @@ abstract class DiagnosticCode {
254244
}) : _correctionMessage = correctionMessage,
255245
_problemMessage = problemMessage;
256246

257-
/**
258-
* The template used to create the correction to be displayed for this
259-
* diagnostic, or `null` if there is no correction information for this
260-
* diagnostic. The correction should indicate how the user can fix the
261-
* diagnostic.
262-
*/
247+
/// The template used to create the correction to be displayed for this
248+
/// diagnostic, or `null` if there is no correction information for this
249+
/// diagnostic. The correction should indicate how the user can fix the
250+
/// diagnostic.
263251
String? get correctionMessage =>
264252
customizedCorrections[uniqueName] ?? _correctionMessage;
265253

@@ -284,28 +272,20 @@ abstract class DiagnosticCode {
284272
return result;
285273
}
286274

287-
/**
288-
* The template used to create the problem message to be displayed for this
289-
* diagnostic. The problem message should indicate what is wrong and why it is
290-
* wrong.
291-
*/
275+
/// The template used to create the problem message to be displayed for this
276+
/// diagnostic. The problem message should indicate what is wrong and why it
277+
/// is wrong.
292278
String get problemMessage =>
293279
customizedMessages[uniqueName] ?? _problemMessage;
294280

295-
/**
296-
* The severity of the diagnostic.
297-
*/
281+
/// The severity of the diagnostic.
298282
DiagnosticSeverity get severity;
299283

300-
/**
301-
* The type of the error.
302-
*/
284+
/// The type of the error.
303285
DiagnosticType get type;
304286

305-
/**
306-
* Return a URL that can be used to access documentation for diagnostics with
307-
* this code, or `null` if there is no published documentation.
308-
*/
287+
/// Return a URL that can be used to access documentation for diagnostics with
288+
/// this code, or `null` if there is no published documentation.
309289
String? get url {
310290
if (hasPublishedDocs) {
311291
return 'https://dart.dev/diagnostics/${name.toLowerCase()}';
@@ -352,46 +332,36 @@ class DiagnosticCodeWithExpectedTypes extends DiagnosticCodeImpl {
352332
});
353333
}
354334

355-
/**
356-
* The severity of an [DiagnosticCode].
357-
*/
335+
/// The severity of an [DiagnosticCode].
358336
@AnalyzerPublicApi(message: 'exported by package:analyzer/error/error.dart')
359337
class DiagnosticSeverity implements Comparable<DiagnosticSeverity> {
360-
/**
361-
* The severity representing a non-error. This is never used for any error
362-
* code, but is useful for clients.
363-
*/
338+
/// The severity representing a non-error. This is never used for any error
339+
/// code, but is useful for clients.
364340
static const DiagnosticSeverity NONE = const DiagnosticSeverity(
365341
'NONE',
366342
0,
367343
" ",
368344
"none",
369345
);
370346

371-
/**
372-
* The severity representing an informational level analysis issue.
373-
*/
347+
/// The severity representing an informational level analysis issue.
374348
static const DiagnosticSeverity INFO = const DiagnosticSeverity(
375349
'INFO',
376350
1,
377351
"I",
378352
"info",
379353
);
380354

381-
/**
382-
* The severity representing a warning. Warnings can become errors if the
383-
* `-Werror` command line flag is specified.
384-
*/
355+
/// The severity representing a warning. Warnings can become errors if the
356+
/// `-Werror` command line flag is specified.
385357
static const DiagnosticSeverity WARNING = const DiagnosticSeverity(
386358
'WARNING',
387359
2,
388360
"W",
389361
"warning",
390362
);
391363

392-
/**
393-
* The severity representing an error.
394-
*/
364+
/// The severity representing an error.
395365
static const DiagnosticSeverity ERROR = const DiagnosticSeverity(
396366
'ERROR',
397367
3,
@@ -410,14 +380,10 @@ class DiagnosticSeverity implements Comparable<DiagnosticSeverity> {
410380

411381
final int ordinal;
412382

413-
/**
414-
* The name of the severity used when producing machine output.
415-
*/
383+
/// The name of the severity used when producing machine output.
416384
final String machineCode;
417385

418-
/**
419-
* The name of the severity used when producing readable output.
420-
*/
386+
/// The name of the severity used when producing readable output.
421387
final String displayName;
422388

423389
const DiagnosticSeverity(
@@ -433,87 +399,71 @@ class DiagnosticSeverity implements Comparable<DiagnosticSeverity> {
433399
@override
434400
int compareTo(DiagnosticSeverity other) => ordinal - other.ordinal;
435401

436-
/**
437-
* Return the severity constant that represents the greatest severity.
438-
*/
402+
/// Return the severity constant that represents the greatest severity.
439403
DiagnosticSeverity max(DiagnosticSeverity severity) =>
440404
this.ordinal >= severity.ordinal ? this : severity;
441405

442406
@override
443407
String toString() => name;
444408
}
445409

446-
/**
447-
* The type of a [DiagnosticCode].
448-
*/
410+
///
411+
/// The type of a [DiagnosticCode].
412+
///
449413
@AnalyzerPublicApi(message: 'exported by package:analyzer/error/error.dart')
450414
class DiagnosticType implements Comparable<DiagnosticType> {
451-
/**
452-
* Task (todo) comments in user code.
453-
*/
415+
/// Task (todo) comments in user code.
454416
static const DiagnosticType TODO = const DiagnosticType(
455417
'TODO',
456418
0,
457419
DiagnosticSeverity.INFO,
458420
);
459421

460-
/**
461-
* Extra analysis run over the code to follow best practices, which are not in
462-
* the Dart Language Specification.
463-
*/
422+
/// Extra analysis run over the code to follow best practices, which are not
423+
/// in the Dart Language Specification.
464424
static const DiagnosticType HINT = const DiagnosticType(
465425
'HINT',
466426
1,
467427
DiagnosticSeverity.INFO,
468428
);
469429

470-
/**
471-
* Compile-time errors are errors that preclude execution. A compile time
472-
* error must be reported by a Dart compiler before the erroneous code is
473-
* executed.
474-
*/
430+
/// Compile-time errors are errors that preclude execution. A compile time
431+
/// error must be reported by a Dart compiler before the erroneous code is
432+
/// executed.
475433
static const DiagnosticType COMPILE_TIME_ERROR = const DiagnosticType(
476434
'COMPILE_TIME_ERROR',
477435
2,
478436
DiagnosticSeverity.ERROR,
479437
);
480438

481-
/**
482-
* Checked mode compile-time errors are errors that preclude execution in
483-
* checked mode.
484-
*/
439+
/// Checked mode compile-time errors are errors that preclude execution in
440+
/// checked mode.
485441
static const DiagnosticType CHECKED_MODE_COMPILE_TIME_ERROR =
486442
const DiagnosticType(
487443
'CHECKED_MODE_COMPILE_TIME_ERROR',
488444
3,
489445
DiagnosticSeverity.ERROR,
490446
);
491447

492-
/**
493-
* Static warnings are those warnings reported by the static checker. They
494-
* have no effect on execution. Static warnings must be provided by Dart
495-
* compilers used during development.
496-
*/
448+
/// Static warnings are those warnings reported by the static checker. They
449+
/// have no effect on execution. Static warnings must be provided by Dart
450+
/// compilers used during development.
497451
static const DiagnosticType STATIC_WARNING = const DiagnosticType(
498452
'STATIC_WARNING',
499453
4,
500454
DiagnosticSeverity.WARNING,
501455
);
502456

503-
/**
504-
* Syntactic errors are errors produced as a result of input that does not
505-
* conform to the grammar.
506-
*/
457+
/// Syntactic errors are errors produced as a result of input that does not
458+
/// conform to the grammar.
507459
static const DiagnosticType SYNTACTIC_ERROR = const DiagnosticType(
508460
'SYNTACTIC_ERROR',
509461
6,
510462
DiagnosticSeverity.ERROR,
511463
);
512464

513-
/**
514-
* Lint warnings describe style and best practice recommendations that can be
515-
* used to formalize a project's style guidelines.
516-
*/
465+
/// Lint warnings describe style and best practice recommendations that can be
466+
/// used to formalize a project's style guidelines.
517467
static const DiagnosticType LINT = const DiagnosticType(
518468
'LINT',
519469
7,
@@ -530,25 +480,17 @@ class DiagnosticType implements Comparable<DiagnosticType> {
530480
LINT,
531481
];
532482

533-
/**
534-
* The name of this error type.
535-
*/
483+
/// The name of this error type.
536484
final String name;
537485

538-
/**
539-
* The ordinal value of the error type.
540-
*/
486+
/// The ordinal value of the error type.
541487
final int ordinal;
542488

543-
/**
544-
* The severity of this type of error.
545-
*/
489+
/// The severity of this type of error.
546490
final DiagnosticSeverity severity;
547491

548-
/**
549-
* Initialize a newly created error type to have the given [name] and
550-
* [severity].
551-
*/
492+
/// Initialize a newly created error type to have the given [name] and
493+
/// [severity].
552494
const DiagnosticType(this.name, this.ordinal, this.severity);
553495

554496
String get displayName => name.toLowerCase().replaceAll('_', ' ');

0 commit comments

Comments
 (0)