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

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

Issue 1749753002: Fix bug when @protected is not on a class member (issue 25882) (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/resolver_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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698