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

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

Issue 1477953002: Fix propagated argument element bug. This fixes #25040. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Alternate fix 2 Created 5 years 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 engine.resolver.element_resolver; 5 library engine.resolver.element_resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'ast.dart'; 9 import 'ast.dart';
10 import 'element.dart'; 10 import 'element.dart';
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 propagatedType = _getPropagatedType(target); 615 propagatedType = _getPropagatedType(target);
616 // 616 //
617 // If this method invocation is of the form 'C.m' where 'C' is a class, 617 // If this method invocation is of the form 'C.m' where 'C' is a class,
618 // then we don't call resolveInvokedElement(...) which walks up the class 618 // then we don't call resolveInvokedElement(...) which walks up the class
619 // hierarchy, instead we just look for the member in the type only. This 619 // hierarchy, instead we just look for the member in the type only. This
620 // does not apply to conditional method invocation (i.e. 'C?.m(...)'). 620 // does not apply to conditional method invocation (i.e. 'C?.m(...)').
621 // 621 //
622 bool isConditional = node.operator.type == sc.TokenType.QUESTION_PERIOD; 622 bool isConditional = node.operator.type == sc.TokenType.QUESTION_PERIOD;
623 ClassElementImpl typeReference = getTypeReference(target); 623 ClassElementImpl typeReference = getTypeReference(target);
624 if (typeReference != null) { 624 if (typeReference != null) {
625 staticElement = 625 staticElement = _resolveElement(typeReference, methodName);
626 propagatedElement = _resolveElement(typeReference, methodName);
627 } else { 626 } else {
628 staticElement = _resolveInvokedElementWithTarget( 627 staticElement = _resolveInvokedElementWithTarget(
629 target, staticType, methodName, isConditional); 628 target, staticType, methodName, isConditional);
630 propagatedElement = _resolveInvokedElementWithTarget( 629 // If we have propagated type information use it (since it should
631 target, propagatedType, methodName, isConditional); 630 // not be redundant with the staticType). Otherwise, don't produce
631 // a propagatedElement which duplicates the staticElement.
632 if (propagatedType is InterfaceType) {
633 propagatedElement = _resolveInvokedElementWithTarget(
634 target, propagatedType, methodName, isConditional);
635 }
632 } 636 }
633 } 637 }
634 staticElement = _convertSetterToGetter(staticElement); 638 staticElement = _convertSetterToGetter(staticElement);
635 propagatedElement = _convertSetterToGetter(propagatedElement); 639 propagatedElement = _convertSetterToGetter(propagatedElement);
636 // 640 //
637 // Record the results. 641 // Record the results.
638 // 642 //
639 methodName.staticElement = staticElement; 643 methodName.staticElement = staticElement;
640 methodName.propagatedElement = propagatedElement; 644 methodName.propagatedElement = propagatedElement;
641 ArgumentList argumentList = node.argumentList; 645 ArgumentList argumentList = node.argumentList;
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 2595
2592 @override 2596 @override
2593 Element get staticElement => null; 2597 Element get staticElement => null;
2594 2598
2595 @override 2599 @override
2596 accept(AstVisitor visitor) => null; 2600 accept(AstVisitor visitor) => null;
2597 2601
2598 @override 2602 @override
2599 void visitChildren(AstVisitor visitor) {} 2603 void visitChildren(AstVisitor visitor) {}
2600 } 2604 }
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