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

feat(transformer/async-to-generator): handle this within arrows function #7074

Conversation

Dunqing
Copy link
Member

@Dunqing Dunqing commented Nov 1, 2024

This is just a poc, I am going to split it into many PRs

Copy link

graphite-app bot commented Nov 1, 2024

Your org has enabled the Graphite merge queue for merging into main

Add 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.

Copy link
Member Author

Dunqing commented Nov 1, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

Join @Dunqing and the rest of your teammates on Graphite Graphite

@Dunqing Dunqing changed the title feat(transformer/async-to-generator): handle this within arrows function feat(transformer/async-to-generator): handle this within arrows function Nov 1, 2024
Copy link

codspeed-hq bot commented Nov 1, 2024

CodSpeed Performance Report

Merging #7074 will degrade performances by 4.3%

Comparing 11-02-feat_transformer_async-to-generator_handle_this_within_arrows_function (0d94534) with 10-31-perf_transformer_arrow-function_change_to_a_correct_scope_id_when_inserting_this (1674cf5)

Summary

❌ 3 regressions
✅ 27 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark 10-31-perf_transformer_arrow-function_change_to_a_correct_scope_id_when_inserting_this 11-02-feat_transformer_async-to-generator_handle_this_within_arrows_function Change
transformer[antd.js] 42.6 ms 44 ms -3.22%
transformer[checker.ts] 16.3 ms 17 ms -4.3%
transformer[pdf.mjs] 6 ms 6.2 ms -4%

@Dunqing Dunqing force-pushed the 10-31-perf_transformer_arrow-function_change_to_a_correct_scope_id_when_inserting_this branch from 1674cf5 to ab06cc1 Compare November 3, 2024 16:07
@Dunqing Dunqing force-pushed the 11-02-feat_transformer_async-to-generator_handle_this_within_arrows_function branch from 0d94534 to 38c99b6 Compare November 3, 2024 16:07
@Dunqing Dunqing force-pushed the 10-31-perf_transformer_arrow-function_change_to_a_correct_scope_id_when_inserting_this branch from ab06cc1 to d320f62 Compare November 3, 2024 16:08
@Dunqing Dunqing force-pushed the 11-02-feat_transformer_async-to-generator_handle_this_within_arrows_function branch from 38c99b6 to 8094309 Compare November 3, 2024 16:08
overlookmotel pushed a commit that referenced this pull request Nov 4, 2024
…inition`'s value to `exit_function` (#7105)

Part of #7074

We need to handle this before the `arrow_function` plugin inserts `_this = this` because, in the `async-to-generator` plugin, we will move the body to an inner generator function. However, we don't want `_this = this` moved to the inner generator function as well. So as long as we move first, and then insert, we can fix this problem.

The new semantic error is related to another tricky problem, I will fix it in another PR
Dunqing added a commit that referenced this pull request Nov 4, 2024
…thodDefinition`'s value to `exit_function` (#7106)

Part of #7074

I have mentioned the reason why I need to move this in #7105
Dunqing added a commit that referenced this pull request Nov 4, 2024
…/ArrowFunctionConverter (#7107)

Part of #7074

In order can reuse the ability of the `ArrowFunction` plugin, we moved out the implementation to common, then we can use use in other plugins
no-yan pushed a commit to no-yan/oxc that referenced this pull request Nov 5, 2024
…thodDefinition`'s value to `exit_function` (oxc-project#7106)

Part of oxc-project#7074

I have mentioned the reason why I need to move this in oxc-project#7105
no-yan pushed a commit to no-yan/oxc that referenced this pull request Nov 5, 2024
…/ArrowFunctionConverter (oxc-project#7107)

Part of oxc-project#7074

In order can reuse the ability of the `ArrowFunction` plugin, we moved out the implementation to common, then we can use use in other plugins
Dunqing added a commit that referenced this pull request Nov 6, 2024
…ator` and `async-generator-functions` plugins (#7113)

Part of #7074

In async-to-generator and async-generator-functions plugins, we may need to transform the async arrow function to a regular generator function, now we can reuse the ability of the ArrowFunction plugin by enabling `ArrowFunctionConverter`.

I will fix semantic errors in the follow-up PR
@Dunqing
Copy link
Member Author

Dunqing commented Nov 6, 2024

Closing as this PR has split into many PRs and has been merged

@Dunqing Dunqing closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant