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

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

Issue 1368793004: fix inference of object members when a method has no target (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 433bae1c7051d9200cd0790eaad8cb706a1b6d0d..c9efc5d5735cb33a3d146d0a027f570f5745d20d 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -1762,6 +1762,15 @@ 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) {
+ return false;
+ }
+
// Object methods called on dynamic targets can have their types improved.
String name = node.methodName.name;
MethodElement inferredElement =
« 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