@@ -1283,15 +1283,28 @@ predicate readStep(Node node1, ContentSet c, Node node2) {
12831283}
12841284
12851285/** Gets the post-update node for which `node` is the corresponding pre-update node. */
1286- private Node getPostUpdate ( Node node ) { result .( PostUpdateNode ) .getPreUpdateNode ( ) = node }
1286+ private Node getPostUpdateForStore ( Node base ) {
1287+ // Some nodes have post-update nodes but should not be targeted by a PropWrite store.
1288+ // Notably, an object literal can have a post-update node it if is an argument to a call,
1289+ // but in this case, we should not target the post-update node, as this would prevent data from
1290+ // flowing into the call.
1291+ exists ( Expr expr |
1292+ base = TValueNode ( expr ) and
1293+ result = TExprPostUpdateNode ( expr )
1294+ |
1295+ expr instanceof PropAccess or
1296+ expr instanceof VarAccess or
1297+ expr instanceof ThisExpr
1298+ )
1299+ }
12871300
1288- /** Gets the post-update node for which node is the pre-update node, if one exists, otherwise gets `node` itself . */
1301+ /** Gets node to target with a store to the given `base` object. . */
12891302pragma [ inline]
1290- private Node tryGetPostUpdate ( Node node ) {
1291- result = getPostUpdate ( node )
1303+ private Node getStoreTarget ( Node base ) {
1304+ result = getPostUpdateForStore ( base )
12921305 or
1293- not exists ( getPostUpdate ( node ) ) and
1294- result = node
1306+ not exists ( getPostUpdateForStore ( base ) ) and
1307+ result = base
12951308}
12961309
12971310pragma [ nomagic]
@@ -1309,7 +1322,7 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
13091322 node1 = write .getRhs ( ) and
13101323 c .asPropertyName ( ) = write .getPropertyName ( ) and
13111324 // Target the post-update node if one exists (for object literals we do not generate post-update nodes)
1312- node2 = tryGetPostUpdate ( write .getBase ( ) )
1325+ node2 = getStoreTarget ( write .getBase ( ) )
13131326 )
13141327 or
13151328 FlowSummaryPrivate:: Steps:: summaryStoreStep ( node1 .( FlowSummaryNode ) .getSummaryNode ( ) , c ,
0 commit comments