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

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

Issue 2304293002: Issue 27221. Report UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER for staticField.method() in su… (Closed)
Patch Set: Created 4 years, 3 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/static_type_warning_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.error_verifier; 5 library analyzer.src.generated.error_verifier;
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 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 6416 matching lines...) Expand 10 before | Expand all | Expand 10 after
6427 /** 6427 /**
6428 * Return `true` if the given [identifier] is in a location where it is 6428 * Return `true` if the given [identifier] is in a location where it is
6429 * allowed to resolve to a static member of a supertype. 6429 * allowed to resolve to a static member of a supertype.
6430 */ 6430 */
6431 bool _isUnqualifiedReferenceToNonLocalStaticMemberAllowed( 6431 bool _isUnqualifiedReferenceToNonLocalStaticMemberAllowed(
6432 SimpleIdentifier identifier) { 6432 SimpleIdentifier identifier) {
6433 if (identifier.inDeclarationContext()) { 6433 if (identifier.inDeclarationContext()) {
6434 return true; 6434 return true;
6435 } 6435 }
6436 AstNode parent = identifier.parent; 6436 AstNode parent = identifier.parent;
6437 if (parent is ConstructorName || 6437 if (parent is Annotation) {
6438 parent is MethodInvocation || 6438 return identical(parent.constructorName, identifier);
6439 parent is PropertyAccess ||
6440 parent is SuperConstructorInvocation) {
6441 return true;
6442 }
6443 if (parent is PrefixedIdentifier &&
6444 identical(parent.identifier, identifier)) {
6445 return true;
6446 }
6447 if (parent is Annotation && identical(parent.constructorName, identifier)) {
6448 return true;
6449 } 6439 }
6450 if (parent is CommentReference) { 6440 if (parent is CommentReference) {
6451 CommentReference commentReference = parent; 6441 return parent.newKeyword != null;
6452 if (commentReference.newKeyword != null) { 6442 }
6453 return true; 6443 if (parent is ConstructorName) {
6454 } 6444 return identical(parent.name, identifier);
6445 }
6446 if (parent is MethodInvocation) {
6447 return identical(parent.methodName, identifier);
6448 }
6449 if (parent is PrefixedIdentifier) {
6450 return identical(parent.identifier, identifier);
6451 }
6452 if (parent is PropertyAccess) {
6453 return identical(parent.propertyName, identifier);
6454 }
6455 if (parent is SuperConstructorInvocation) {
6456 return identical(parent.constructorName, identifier);
6455 } 6457 }
6456 return false; 6458 return false;
6457 } 6459 }
6458 6460
6459 bool _isUserDefinedObject(EvaluationResultImpl result) => 6461 bool _isUserDefinedObject(EvaluationResultImpl result) =>
6460 result == null || 6462 result == null ||
6461 (result.value != null && result.value.isUserDefinedObject); 6463 (result.value != null && result.value.isUserDefinedObject);
6462 6464
6463 /** 6465 /**
6464 * Check that the given class [element] is not a superinterface to itself. The 6466 * Check that the given class [element] is not a superinterface to itself. The
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
6722 class _InvocationCollector extends RecursiveAstVisitor { 6724 class _InvocationCollector extends RecursiveAstVisitor {
6723 final List<String> superCalls = <String>[]; 6725 final List<String> superCalls = <String>[];
6724 6726
6725 @override 6727 @override
6726 visitMethodInvocation(MethodInvocation node) { 6728 visitMethodInvocation(MethodInvocation node) {
6727 if (node.target is SuperExpression) { 6729 if (node.target is SuperExpression) {
6728 superCalls.add(node.methodName.name); 6730 superCalls.add(node.methodName.name);
6729 } 6731 }
6730 } 6732 }
6731 } 6733 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698