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

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

Issue 1797583003: Warn about deprecated fields (issue 22963) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 /** 528 /**
529 * Given some [Element], look at the associated metadata and report the use of the member if 529 * Given some [Element], look at the associated metadata and report the use of the member if
530 * it is declared as deprecated. 530 * it is declared as deprecated.
531 * 531 *
532 * @param element some element to check for deprecated use of 532 * @param element some element to check for deprecated use of
533 * @param node the node use for the location of the error 533 * @param node the node use for the location of the error
534 * @return `true` if and only if a hint code is generated on the passed node 534 * @return `true` if and only if a hint code is generated on the passed node
535 * See [HintCode.DEPRECATED_MEMBER_USE]. 535 * See [HintCode.DEPRECATED_MEMBER_USE].
536 */ 536 */
537 void _checkForDeprecatedMemberUse(Element element, AstNode node) { 537 void _checkForDeprecatedMemberUse(Element element, AstNode node) {
538 if (element != null && element.isDeprecated && !inDeprecatedMember) { 538 bool isDeprecated(Element element) {
539 if (element == null) {
540 return false;
541 } else if (element is PropertyAccessorElement && element.isSynthetic) {
542 element = (element as PropertyAccessorElement).variable;
543 if (element == null) {
544 return false;
545 }
546 }
547 return element.isDeprecated;
548 }
549 if (!inDeprecatedMember && isDeprecated(element)) {
539 String displayName = element.displayName; 550 String displayName = element.displayName;
540 if (element is ConstructorElement) { 551 if (element is ConstructorElement) {
541 // TODO(jwren) We should modify ConstructorElement.getDisplayName(), 552 // TODO(jwren) We should modify ConstructorElement.getDisplayName(),
542 // or have the logic centralized elsewhere, instead of doing this logic 553 // or have the logic centralized elsewhere, instead of doing this logic
543 // here. 554 // here.
544 ConstructorElement constructorElement = element; 555 ConstructorElement constructorElement = element;
545 displayName = constructorElement.enclosingElement.displayName; 556 displayName = constructorElement.enclosingElement.displayName;
546 if (!constructorElement.displayName.isEmpty) { 557 if (!constructorElement.displayName.isEmpty) {
547 displayName = "$displayName.${constructorElement.displayName}"; 558 displayName = "$displayName.${constructorElement.displayName}";
548 } 559 }
(...skipping 12413 matching lines...) Expand 10 before | Expand all | Expand 10 after
12962 nonFields.add(node); 12973 nonFields.add(node);
12963 return null; 12974 return null;
12964 } 12975 }
12965 12976
12966 @override 12977 @override
12967 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 12978 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
12968 12979
12969 @override 12980 @override
12970 Object visitWithClause(WithClause node) => null; 12981 Object visitWithClause(WithClause node) => null;
12971 } 12982 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698