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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1066083002: Report unused function type aliases. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 0d20c8b1c7b4dbb7081d8dcfc2cfcab0126cc129..9c12b2dd44d7fae34a272c75e58ca124b4584c9b 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -4568,7 +4568,9 @@ class GatherUsedLocalElementsVisitor extends RecursiveAstVisitor {
if (parent2 is IsExpression) {
return;
}
- if (parent2 is VariableDeclarationList) {
+ // We need to instantiate/extend/implement a class to actually use it.
+ // OTOH, function type aliases are used to define closure structures.
+ if (parent2 is VariableDeclarationList && element is ClassElement) {
return;
}
}
@@ -14907,6 +14909,17 @@ class UnusedLocalElementsVerifier extends RecursiveElementVisitor {
}
@override
+ visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
+ if (!_isUsedElement(element)) {
+ _reportErrorForElement(HintCode.UNUSED_ELEMENT, element, [
+ element.kind.displayName,
+ element.displayName
+ ]);
+ }
+ super.visitFunctionTypeAliasElement(element);
+ }
+
+ @override
visitLocalVariableElement(LocalVariableElement element) {
if (!_isUsedElement(element) && !_isNamedUnderscore(element)) {
HintCode errorCode;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698