| OLD | NEW |
| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 /** | 645 /** |
| 646 * Produces a hint if the given identifier is a protected field or getter | 646 * Produces a hint if the given identifier is a protected field or getter |
| 647 * accessed outside a subclass. | 647 * accessed outside a subclass. |
| 648 */ | 648 */ |
| 649 void _checkForInvalidProtectedPropertyAccess(SimpleIdentifier identifier) { | 649 void _checkForInvalidProtectedPropertyAccess(SimpleIdentifier identifier) { |
| 650 if (identifier.inDeclarationContext()) { | 650 if (identifier.inDeclarationContext()) { |
| 651 return; | 651 return; |
| 652 } | 652 } |
| 653 Element element = identifier.bestElement; | 653 Element element = identifier.bestElement; |
| 654 if (element is PropertyAccessorElement && | 654 if (element is PropertyAccessorElement && |
| 655 element.enclosingElement is ClassElement && |
| 655 (element.isProtected || element.variable.isProtected)) { | 656 (element.isProtected || element.variable.isProtected)) { |
| 656 ClassElement definingClass = element.enclosingElement; | 657 ClassElement definingClass = element.enclosingElement; |
| 657 if (definingClass == null) { | |
| 658 return; | |
| 659 } | |
| 660 ClassDeclaration accessingClass = | 658 ClassDeclaration accessingClass = |
| 661 identifier.getAncestor((AstNode node) => node is ClassDeclaration); | 659 identifier.getAncestor((AstNode node) => node is ClassDeclaration); |
| 662 | 660 |
| 663 if (accessingClass == null) { | 661 if (accessingClass == null) { |
| 664 _errorReporter.reportErrorForNode( | 662 _errorReporter.reportErrorForNode( |
| 665 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, | 663 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, |
| 666 identifier, | 664 identifier, |
| 667 [identifier.name.toString(), definingClass.name]); | 665 [identifier.name.toString(), definingClass.name]); |
| 668 } else if (!_hasSuperClassOrMixin( | 666 } else if (!_hasSuperClassOrMixin( |
| 669 accessingClass.element, definingClass.type)) { | 667 accessingClass.element, definingClass.type)) { |
| (...skipping 12317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12987 nonFields.add(node); | 12985 nonFields.add(node); |
| 12988 return null; | 12986 return null; |
| 12989 } | 12987 } |
| 12990 | 12988 |
| 12991 @override | 12989 @override |
| 12992 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 12990 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
| 12993 | 12991 |
| 12994 @override | 12992 @override |
| 12995 Object visitWithClause(WithClause node) => null; | 12993 Object visitWithClause(WithClause node) => null; |
| 12996 } | 12994 } |
| OLD | NEW |