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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 1374773003: fix inference of object members on library prefix (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix cascades Created 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index c9efc5d5735cb33a3d146d0a027f570f5745d20d..b6a959579daa8cde9549549b49bf7337665f73c5 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -1762,12 +1762,11 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
* being called is one of the object methods.
*/
bool _inferMethodInvocationObject(MethodInvocation node) {
- // If we have a call like `toString()` don't infer it.
- //
- // Either: it's really `this.toString()` and we shouldn't need inference,
- // or it's a call to a function that happens to be called `toString()` and
- // we shouldn't infer.
- if (node.target == null) {
+ // If we have a call like `toString()` or `libraryPrefix.toString()` don't
+ // infer it.
+ Expression target = node.realTarget;
+ if (target == null ||
+ target is SimpleIdentifier && target.staticElement is PrefixElement) {
return false;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | pkg/analyzer/test/generated/resolver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698