Skip to content

Commit fe1da36

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Change the wording of unused-element
I think this makes the message better, but it also means that the message can be internationalized. Change-Id: I0697fc05b79e33d5af2424609b30c2832b1a210b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109860 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 977a78b commit fe1da36

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

pkg/analyzer/lib/src/dart/error/hint_codes.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/error/error.dart';
6-
import 'package:analyzer/src/dart/element/element.dart';
76

87
/**
98
* The hints and coding recommendations for best practices which are not
@@ -839,11 +838,12 @@ class HintCode extends ErrorCode {
839838
correction: "Try removing the stack trace variable, or using it.");
840839

841840
/**
842-
* See [Modifier.IS_USED_IN_LIBRARY].
841+
* Parameters:
842+
* 0: The name that is declared but not referenced.
843843
*/
844844
static const HintCode UNUSED_ELEMENT = const HintCode(
845-
'UNUSED_ELEMENT', "The {0} '{1}' isn't used.",
846-
correction: "Try removing the declaration of '{1}'.");
845+
'UNUSED_ELEMENT', "The declaration '{0}' isn't referenced.",
846+
correction: "Try removing the declaration of '{0}'.");
847847

848848
/**
849849
* Unused fields are fields which are never read.

pkg/analyzer/lib/src/generated/resolver.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8543,8 +8543,8 @@ class UnusedLocalElementsVerifier extends RecursiveAstVisitor {
85438543

85448544
_visitClassElement(ClassElement element) {
85458545
if (!_isUsedElement(element)) {
8546-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8547-
[element.kind.displayName, element.displayName]);
8546+
_reportErrorForElement(
8547+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
85488548
}
85498549
}
85508550

@@ -8557,15 +8557,15 @@ class UnusedLocalElementsVerifier extends RecursiveAstVisitor {
85578557

85588558
_visitFunctionElement(FunctionElement element) {
85598559
if (!_isUsedElement(element)) {
8560-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8561-
[element.kind.displayName, element.displayName]);
8560+
_reportErrorForElement(
8561+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
85628562
}
85638563
}
85648564

85658565
_visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
85668566
if (!_isUsedElement(element)) {
8567-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8568-
[element.kind.displayName, element.displayName]);
8567+
_reportErrorForElement(
8568+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
85698569
}
85708570
}
85718571

@@ -8585,22 +8585,22 @@ class UnusedLocalElementsVerifier extends RecursiveAstVisitor {
85858585

85868586
_visitMethodElement(MethodElement element) {
85878587
if (!_isUsedMember(element)) {
8588-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8589-
[element.kind.displayName, element.displayName]);
8588+
_reportErrorForElement(
8589+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
85908590
}
85918591
}
85928592

85938593
_visitPropertyAccessorElement(PropertyAccessorElement element) {
85948594
if (!_isUsedMember(element)) {
8595-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8596-
[element.kind.displayName, element.displayName]);
8595+
_reportErrorForElement(
8596+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
85978597
}
85988598
}
85998599

86008600
_visitTopLevelVariableElement(TopLevelVariableElement element) {
86018601
if (!_isUsedElement(element)) {
8602-
_reportErrorForElement(HintCode.UNUSED_ELEMENT, element,
8603-
[element.kind.displayName, element.displayName]);
8602+
_reportErrorForElement(
8603+
HintCode.UNUSED_ELEMENT, element, [element.displayName]);
86048604
}
86058605
}
86068606
}

0 commit comments

Comments
 (0)