Skip to content

Commit 7e09901

Browse files
stereotype441Commit Queue
authored andcommitted
[analyzer] Fix unnecessary recursive call to ResolverVisitor.resolveForWrite.
When `ResolverVisitor.resolveForWrite` rewrites the LHS of an assignment from a prefixed identifier to a property access (which it only does for record types), it's not necessary to make a recursive call to `resolveForWrite`, because the target of the property access has already been resolved. It's only necessary to resolve the property itself, which can be done by calling `PropertyElementResolver.resolvePropertyAccess` directly. This change helps pave the way for a follow-up CL in which I'll be adding assertions that fire if the `ResolverVisitor` tries to resolve a given subexpression multiple times. (Doing so is dangerous because it can interfere with the correctness of flow analysis.) Change-Id: I41c0aaa75b4e7902d584ce36bd0a87874f0eaf8f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400040 Reviewed-by: Brian Wilkerson <[email protected]> Auto-Submit: Paul Berry <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent 4c3ab23 commit 7e09901

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/analyzer/lib/src/generated/resolver.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,10 +1482,8 @@ class ResolverVisitor extends ThrowingAstVisitor<void>
14821482
);
14831483
NodeReplacer.replace(node, propertyAccess);
14841484
inferenceLogWriter?.exitLValue(node);
1485-
return resolveForWrite(
1486-
node: propertyAccess,
1487-
hasRead: hasRead,
1488-
);
1485+
return _propertyElementResolver.resolvePropertyAccess(
1486+
node: propertyAccess, hasRead: hasRead, hasWrite: true);
14891487
}
14901488

14911489
inferenceLogWriter?.exitLValue(node);

0 commit comments

Comments
 (0)