Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 935d5fa

Browse files
stereotype441Commit Queue
authored and
Commit Queue
committed
[messages] Switch verify_docs.dart to new analyzer diagnostic codes.
I'm currently going through a process of updating the analyzer and related packages so that their diagnostic codes are generated into top level constant declarations in `diagnostic.dart` files rather than static constants inside of classes like `CompileTimeErrorCode`. This will help pave the way for unifying the treatment of diagnostic codes between the analyzer and the CFE (since the CFE doesn't segregate diagnostic codes into subclasses the way the analyzer does). At the moment, both the old and the new constants exist, to allow client code to be transitioned from one to the other. This change transitions the references in `verify_docs.dart` over to refer to the new top level constant declarations. Change-Id: I6a6a6964d9a806b9b45394f2c1826fb71fbff681 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/462163 Reviewed-by: Nate Bosch <nbosch@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
1 parent 6781363 commit 935d5fa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎tools/verify_docs/bin/verify_docs.dart‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import 'package:analyzer/file_system/overlay_file_system.dart';
2020
import 'package:analyzer/file_system/physical_file_system.dart';
2121
import 'package:analyzer/source/line_info.dart';
2222
import 'package:analyzer/src/dart/analysis/experiments.dart'; // ignore: implementation_imports
23-
import 'package:analyzer/src/error/codes.dart'; // ignore: implementation_imports
23+
import 'package:analyzer/src/diagnostic/diagnostic.dart' // ignore: implementation_imports
24+
as diag;
2425
import 'package:analyzer/src/util/comment.dart'; // ignore: implementation_imports
2526
import 'package:path/path.dart' as path;
2627

@@ -342,22 +343,21 @@ class ValidateCommentCodeSamplesVisitor extends GeneralizingAstVisitor {
342343

343344
// Filter out unused imports, since we speculatively add imports to some
344345
// samples.
345-
diagnostics
346-
.removeWhere((e) => e.diagnosticCode == WarningCode.unusedImport);
346+
diagnostics.removeWhere((e) => e.diagnosticCode == diag.unusedImport);
347347

348348
// Also, don't worry about 'unused_local_variable' and related; this may
349349
// be intentional in samples.
350350
diagnostics.removeWhere(
351351
(e) =>
352-
e.diagnosticCode == WarningCode.unusedLocalVariable ||
353-
e.diagnosticCode == WarningCode.unusedElement,
352+
e.diagnosticCode == diag.unusedLocalVariable ||
353+
e.diagnosticCode == diag.unusedElement,
354354
);
355355

356356
// Handle edge case around dart:_http
357357
diagnostics.removeWhere((e) {
358358
if (e.message.contains("'dart:_http'")) {
359-
return e.diagnosticCode == HintCode.unnecessaryImport ||
360-
e.diagnosticCode == CompileTimeErrorCode.importInternalLibrary;
359+
return e.diagnosticCode == diag.unnecessaryImport ||
360+
e.diagnosticCode == diag.importInternalLibrary;
361361
}
362362
return false;
363363
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /