| 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 element.isProtected) { | 746 element.isProtected) { |
| 747 return true; | 747 return true; |
| 748 } | 748 } |
| 749 return false; | 749 return false; |
| 750 } | 750 } |
| 751 | 751 |
| 752 bool inCommentReference(SimpleIdentifier identifier) => | 752 bool inCommentReference(SimpleIdentifier identifier) => |
| 753 identifier.getAncestor((AstNode node) => node is CommentReference) != | 753 identifier.getAncestor((AstNode node) => node is CommentReference) != |
| 754 null; | 754 null; |
| 755 | 755 |
| 756 bool inCurrentLibrary(Element element) => |
| 757 element.library == _currentLibrary; |
| 758 |
| 756 Element element = identifier.bestElement; | 759 Element element = identifier.bestElement; |
| 757 if (isProtected(element) && !inCommentReference(identifier)) { | 760 if (isProtected(element) && |
| 761 !inCurrentLibrary(element) && |
| 762 !inCommentReference(identifier)) { |
| 758 ClassElement definingClass = element.enclosingElement; | 763 ClassElement definingClass = element.enclosingElement; |
| 759 ClassDeclaration accessingClass = | 764 ClassDeclaration accessingClass = |
| 760 identifier.getAncestor((AstNode node) => node is ClassDeclaration); | 765 identifier.getAncestor((AstNode node) => node is ClassDeclaration); |
| 761 if (accessingClass == null || | 766 if (accessingClass == null || |
| 762 !_hasTypeOrSuperType(accessingClass.element, definingClass.type)) { | 767 !_hasTypeOrSuperType(accessingClass.element, definingClass.type)) { |
| 763 _errorReporter.reportErrorForNode( | 768 _errorReporter.reportErrorForNode( |
| 764 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, | 769 HintCode.INVALID_USE_OF_PROTECTED_MEMBER, |
| 765 identifier, | 770 identifier, |
| 766 [identifier.name.toString(), definingClass.name]); | 771 [identifier.name.toString(), definingClass.name]); |
| 767 } | 772 } |
| (...skipping 10250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11018 return null; | 11023 return null; |
| 11019 } | 11024 } |
| 11020 if (identical(node.staticElement, variable)) { | 11025 if (identical(node.staticElement, variable)) { |
| 11021 if (node.inSetterContext()) { | 11026 if (node.inSetterContext()) { |
| 11022 result = true; | 11027 result = true; |
| 11023 } | 11028 } |
| 11024 } | 11029 } |
| 11025 return null; | 11030 return null; |
| 11026 } | 11031 } |
| 11027 } | 11032 } |
| OLD | NEW |