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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 724113002: Report HintCode.UNUSED_ELEMENT for non-synthetic property accessors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library engine.resolver; 5 library engine.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 15714 matching lines...) Expand 10 before | Expand all | Expand 10 after
15725 visitMethodElement(MethodElement element) { 15725 visitMethodElement(MethodElement element) {
15726 if (!_isUsedMember(element)) { 15726 if (!_isUsedMember(element)) {
15727 _reportErrorForElement( 15727 _reportErrorForElement(
15728 HintCode.UNUSED_ELEMENT, 15728 HintCode.UNUSED_ELEMENT,
15729 element, 15729 element,
15730 [element.kind.displayName, element.displayName]); 15730 [element.kind.displayName, element.displayName]);
15731 } 15731 }
15732 super.visitMethodElement(element); 15732 super.visitMethodElement(element);
15733 } 15733 }
15734 15734
15735 @override
15736 visitPropertyAccessorElement(PropertyAccessorElement element) {
15737 if (!element.isSynthetic && !_isUsedMember(element)) {
15738 _reportErrorForElement(
15739 HintCode.UNUSED_ELEMENT,
15740 element,
15741 [element.kind.displayName, element.displayName]);
15742 }
15743 super.visitPropertyAccessorElement(element);
15744 }
15745
15735 bool _isUsedElement(Element element) { 15746 bool _isUsedElement(Element element) {
15736 if (element is! LocalVariableElement) { 15747 if (element is! LocalVariableElement) {
15737 if (element.isPublic) { 15748 if (element.isPublic) {
15738 return true; 15749 return true;
15739 } 15750 }
15740 } 15751 }
15741 return _usedElements.elements.contains(element); 15752 return _usedElements.elements.contains(element);
15742 } 15753 }
15743 15754
15744 bool _isUsedMember(Element element) { 15755 bool _isUsedMember(Element element) {
(...skipping 11 matching lines...) Expand all
15756 _errorListener.onError( 15767 _errorListener.onError(
15757 new AnalysisError.con2( 15768 new AnalysisError.con2(
15758 element.source, 15769 element.source,
15759 element.nameOffset, 15770 element.nameOffset,
15760 element.displayName.length, 15771 element.displayName.length,
15761 errorCode, 15772 errorCode,
15762 arguments)); 15773 arguments));
15763 } 15774 }
15764 } 15775 }
15765 } 15776 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | pkg/analyzer/test/generated/resolver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698