fix(transformer/logic-assignment-operator): always create IdentifierReferences with ReferenceId#7745
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
|
I'm seeing weird interactions between logical assignment operator + class properties transforms. I thought the fault might be in logical assignment operator transform, so that's why I added these tests. But no! They pass. 😢 |
0c38523 to
61df605
Compare
|
Ah ha no! I made a mistake in the tests. The problem is in this transform. I'll try to fix. |
61df605 to
3b141c6
Compare
CodSpeed Performance ReportMerging #7745 will not alter performanceComparing Summary
|
IdentifierReferences with ReferenceId
|
@Dunqing Could you please take a look and make sure I'm not missing anything? I think this simplification of the code retains its original behavior, but I don't know this transform, so I might have made a mistake. |
|
There is one thing I changed. Previously some I think this is OK, because |
Merge activity
|
…Reference`s with `ReferenceId` (#7745) Use `TransformCtx::duplicate_expression` (introduced in #7754) to decide when to create temp vars for member expression object and computed property. This fixes a bug where `IdentifierReference`s created when transforming `key` in `object[key] &&= value` were created without a `ReferenceId` (due to `clone_in`). We didn't catch this before because Babel's test fixtures only cover `object[key++] &&= value` not the simpler `object[key] &&= value`. Add tests for this.
5e49bbd to
9c2a1b6
Compare
3b141c6 to
e48769a
Compare
`TraverseCtx::is_static` was only used in logical assignment operators transform, and #7745 removed that usage. So remove this method. `TransformCtx::duplicate_expression` fulfills the same role.

Use
TransformCtx::duplicate_expression(introduced in #7754) to decide when to create temp vars for member expression object and computed property.This fixes a bug where
IdentifierReferences created when transformingkeyinobject[key] &&= valuewere created without aReferenceId(due toclone_in).We didn't catch this before because Babel's test fixtures only cover
object[key++] &&= valuenot the simplerobject[key] &&= value. Add tests for this.