Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jul 29, 2025

The removal of AstKind::SimpleAssignmentTarget (#12401) has made it harder to determine if a node is being assigned to, because you can no longer check if the parent AstNode is AstKind::SimpleAssignmentTarget.

Add a method to MemberExpressionKind which determines whether the parent assigns to it. Covers all possible positions where a MemberExpression gets assigned to - x.y = value, x.y++, [x.y] = arr etc.

We can use this method to avoid repeating this complicated logic in many places.

@github-actions github-actions bot added A-ast Area - AST C-enhancement Category - New feature or request labels Jul 29, 2025
Copy link
Member Author

overlookmotel commented Jul 29, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 29, 2025

CodSpeed Instrumentation Performance Report

Merging #12596 will not alter performance

Comparing 07-29-feat_ast_add_memberexpressionkind_is_assigned_to_in_parent_method (106f56f) with main (3b9f1f0)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on 07-29-feat_ast_implement_getaddress_for_memberexpressionkind_ (c763e0e) during the generation of this report, so main (3b9f1f0) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review July 29, 2025 22:15
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jul 30, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 30, 2025

Merge activity

#12596)

The removal of `AstKind::SimpleAssignmentTarget` (#12401) has made it harder to determine if a node is being assigned to, because you can no longer check if the parent `AstNode` is `AstKind::SimpleAssignmentTarget`.

Add a method to `MemberExpressionKind` which determines whether the parent assigns to it. Covers all possible positions where a `MemberExpression` gets assigned to - `x.y = value`, `x.y++`, `[x.y] = arr` etc.

We can use this method to avoid repeating this complicated logic in many places.
@graphite-app graphite-app bot force-pushed the 07-29-feat_ast_implement_getaddress_for_memberexpressionkind_ branch from c957caa to c763e0e Compare July 30, 2025 01:24
@graphite-app graphite-app bot force-pushed the 07-29-feat_ast_add_memberexpressionkind_is_assigned_to_in_parent_method branch from 3279c53 to 106f56f Compare July 30, 2025 01:25
graphite-app bot pushed a commit that referenced this pull request Jul 30, 2025
…thod (#12597)

Similar to #12596.

Add a method `AstKind::ident_reference_is_assigned_to_in_parent`. Given an `AstKind` representing an `IdentifierReference`, and an `AstKind` representing its parent, this method determines whether the identifier is being assigned to.

Covers all possible positions where an `IdentifierReference` gets assigned to - `x = value`, `x++`, `[...x] = arr` etc.

Note: This method is slightly different to `MemberExpressionKind::is_assigned_to_in_parent` - it includes additional match arm for `AssignmentTargetPropertyIdentifier` as parent. This can't be parent of a `MemberExpression`, but *can* be the parent of an `IdentifierReference`.
Base automatically changed from 07-29-feat_ast_implement_getaddress_for_memberexpressionkind_ to main July 30, 2025 01:32
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 30, 2025
@graphite-app graphite-app bot merged commit 106f56f into main Jul 30, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 07-29-feat_ast_add_memberexpressionkind_is_assigned_to_in_parent_method branch July 30, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants