Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transformer/arrow-functions): transform this and super incorrectly in async arrow function #8435

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Jan 11, 2025

close: #8385

This PR is to solve the missing super transform in the async arrow function, and _this = this inserts to an incorrect place. These problems are all about the async arrow function, which is a part of the init of class property. Learn more at #8387.

The output matches Babel's output except for static prop as Babel transforms incorrectly.

Copy link
Member Author

Dunqing commented Jan 11, 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.

@github-actions github-actions bot added A-transformer Area - Transformer / Transpiler C-bug Category - Bug labels Jan 11, 2025
@Dunqing Dunqing changed the title fix(transformer/arrow-functions): transform this and super incorrectly in async arrow function fix(transformer/arrow-functions): transform this and super incorrectly in async arrow function Jan 11, 2025
Copy link

codspeed-hq bot commented Jan 11, 2025

CodSpeed Performance Report

Merging #8435 will improve performances by 3.27%

Comparing 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function (c444de8) with main (4071878)

Summary

⚡ 1 improvements
✅ 31 untouched benchmarks

Benchmarks breakdown

Benchmark main 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function Change
semantic[cal.com.tsx] 27.1 ms 26.2 ms +3.27%

@Dunqing Dunqing force-pushed the 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function branch from f25accd to 479a96d Compare January 11, 2025 15:46
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 13, 2025
Copy link
Contributor

overlookmotel commented Jan 13, 2025

Merge activity

  • Jan 13, 6:30 PM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 13, 6:48 PM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 14, 3:34 AM EST: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 14, 3:39 AM EST: A user added this pull request to the Graphite merge queue.
  • Jan 14, 3:45 AM EST: A user merged this pull request with the Graphite merge queue.

@overlookmotel overlookmotel removed the 0-merge Merge with Graphite Merge Queue label Jan 13, 2025
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 13, 2025
@overlookmotel
Copy link
Contributor

overlookmotel commented Jan 13, 2025

@Dunqing I've fixed merge conflicts on #8387 below locally, and have a few nitty commits to add to this PR. But cannot push right now because Github is having an outage. I'll try again in the morning, and will get this merged.

@overlookmotel overlookmotel removed the 0-merge Merge with Graphite Merge Queue label Jan 13, 2025
@overlookmotel overlookmotel force-pushed the 01-09-test_transformer_async-to-generator_failing_test_for_async_arrow_function_in_class_static_block branch from 953d1b5 to 9b60f5f Compare January 14, 2025 08:34
@overlookmotel overlookmotel force-pushed the 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function branch from 01f2314 to 5f9419d Compare January 14, 2025 08:34
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 14, 2025
…ectly in async arrow function (#8435)

close: #8385

This PR is to solve the missing `super` transform in the async arrow function, and `_this = this` inserts to an incorrect place. These problems are all about the async arrow function, which is a part of the init of class property. Learn more at #8387.

The output matches Babel's output except for static prop as Babel transforms incorrectly.
@overlookmotel overlookmotel force-pushed the 01-09-test_transformer_async-to-generator_failing_test_for_async_arrow_function_in_class_static_block branch from 9b60f5f to 0358c6f Compare January 14, 2025 08:38
@overlookmotel overlookmotel force-pushed the 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function branch from 5f9419d to c444de8 Compare January 14, 2025 08:39
Base automatically changed from 01-09-test_transformer_async-to-generator_failing_test_for_async_arrow_function_in_class_static_block to main January 14, 2025 08:43
@graphite-app graphite-app bot merged commit c444de8 into main Jan 14, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 01-11-fix_transformer_arrow-functions_transform_this_and_super_incorrectly_in_async_arrow_function branch January 14, 2025 08:45
Boshen added a commit that referenced this pull request Jan 14, 2025
## [0.46.0] - 2025-01-14

- 7eb6ccd ast: [**BREAKING**] Remove unused and not useful `ContentHash`
(#8483) (Boshen)

### Features

- 8accfef minifier: Minify `var x; void x` -> `void 0` (#8466) (Boshen)
- 870a583 minifier: Fold `false['toString']` (#8447) (Boshen)
- 4ad695d napi/minify: Implement napi (#8478) (Boshen)
- 9d550aa span: Add `Atom::r#static` (#8479) (_Kerman)

### Bug Fixes

- 4071878 isolated-declarations: Retain `declare` declarations when they
are exported (#8477) (Dunqing)
- 7ee7634 isolated-declarations: Import statement disappears when import
binding is referenced in nested `typeof` (#8476) (Dunqing)
- 7252cb0 isolated-declarations: Unexpected error when global `Symbol`
as property key (#8475) (Dunqing)
- 4c6675c minifier: Do not convert while to fors in DCE (#8484) (Boshen)
- 1d6e84d minifier: Fix incorrect `null.toString()` and `1n.toString()`
(#8464) (Boshen)
- 25d4bf9 minifier: Remove usage of empty spans (#8462) (Boshen)
- dd64340 minifier: Keep `return undefined` in async generator function
(#8439) (Boshen)
- c444de8 transformer/arrow-functions: Transform `this` and `super`
incorrectly in async arrow function (#8435) (Dunqing)
- 270245f transformer/typescript: Correct the semantic for
TSImportEqualsDeclaration transformation (#8463) (Dunqing)
- 2a400d6 transformer/typescript: Retain TSImportEqualsDeclaration when
it is exported (Dunqing)
- ab694b0 transformer/typescript: Retain `TSImportEqualsDeclaration` in
`namespace` when its binding has been referenced or
`onlyRemoveTypeImports` is true (#8458) (Dunqing)

### Performance

- 7a8200c mangler: Allocate base54 name without heap allocation (#8472)
(Boshen)
- 31dac22 mangler: Allocate data in arena (#8471) (Boshen)
- 8fc238a minifier: Merge `Normalize` and `RemoveSyntax` pass (#8467)
(Boshen)
- 372eb09 minifier: Preallocate mangler's semantic data (#8451) (Boshen)

### Refactor

- 6e64eef codegen: Remove `match_expression!` (#8450) (Boshen)
- de5b288 span: Rename `Atom::new_const` method (#8480) (overlookmotel)
- c83ce5c transformer/typescript: Improve transforming namespace (#8459)
(Dunqing)

Co-authored-by: Boshen <[email protected]>
Dunqing pushed a commit that referenced this pull request Jan 14, 2025
Follow-on after #8435. Pure refactor. Rename method to `in_class_property_definition_value`. I think that name is more descriptive than `if_ancestor_of_class_property_definition_value`, since the method does not take an `Ancestor` as parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-transformer Area - Transformer / Transpiler C-bug Category - Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggested changes to arrow functions transform
2 participants