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 function transform use UIDs for _this vars #3634

Conversation

overlookmotel
Copy link
Contributor

@overlookmotel overlookmotel commented Jun 11, 2024

Change arrow function transform to use UIDs for _this vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions

Copy link

graphite-app bot commented Jun 11, 2024

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

Add the label “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.

@overlookmotel overlookmotel marked this pull request as ready for review June 11, 2024 21:07
@github-actions github-actions bot added the A-transformer Area - Transformer / Transpiler label Jun 11, 2024
Copy link

codspeed-hq bot commented Jun 11, 2024

CodSpeed Performance Report

Merging #3634 will not alter performance

Comparing 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars (35e267b) with main (f6752b4)

Summary

✅ 22 untouched benchmarks

@overlookmotel overlookmotel force-pushed the 06-11-fix_transformer_arrow_func_transform_maintain_scope_id branch from c1601d8 to 777f590 Compare June 11, 2024 21:49
@overlookmotel overlookmotel force-pushed the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch 2 times, most recently from 6aec002 to 6730353 Compare June 12, 2024 00:38
Copy link

graphite-app bot commented Jun 12, 2024

Merge activity

@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_func_transform_maintain_scope_id branch from 777f590 to 40d25f8 Compare June 12, 2024 02:57
Boshen pushed a commit that referenced this pull request Jun 12, 2024
…3634)

Change arrow function transform to use UIDs for `_this` vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch from 6730353 to ea641a2 Compare June 12, 2024 02:57
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_func_transform_maintain_scope_id branch from 40d25f8 to 95825d6 Compare June 12, 2024 03:00
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch from ea641a2 to 5bad16c Compare June 12, 2024 03:01
Boshen pushed a commit that referenced this pull request Jun 12, 2024
…3634)

Change arrow function transform to use UIDs for `_this` vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_func_transform_maintain_scope_id branch from 95825d6 to d2d9aca Compare June 12, 2024 04:11
Boshen pushed a commit that referenced this pull request Jun 12, 2024
…3634)

Change arrow function transform to use UIDs for `_this` vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch from 5bad16c to 5c22e06 Compare June 12, 2024 04:12
…3634)

Change arrow function transform to use UIDs for `_this` vars, which can't clash with an existing binding.

I believe there are some problems with our current implementation, but have struggled to fix them due to weird interactions with TS transforms. Have added "TODO" comments, so we can return to this and fix them later on, once scopes in TS transforms are correct.

My failed attempt at fixing is on this branch: https://github.com/oxc-project/oxc/tree/transform-arrow-functions
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_func_transform_maintain_scope_id branch from d2d9aca to 39bdebc Compare June 12, 2024 05:22
@Boshen Boshen force-pushed the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch from 5c22e06 to 35e267b Compare June 12, 2024 05:23
@Boshen Boshen changed the base branch from 06-11-fix_transformer_arrow_func_transform_maintain_scope_id to main June 12, 2024 05:26
An error occurred while trying to automatically change base from 06-11-fix_transformer_arrow_func_transform_maintain_scope_id to main June 12, 2024 05:26
@graphite-app graphite-app bot merged commit 35e267b into main Jun 12, 2024
22 checks passed
@graphite-app graphite-app bot deleted the 06-11-fix_transformer_arrow_function_transform_use_uids_for__this_vars branch June 12, 2024 05:28
This was referenced Jun 12, 2024
Boshen added a commit that referenced this pull request Jun 12, 2024
## [0.14.0] - 2024-06-12

### Breaking

* fix(codegen)!: remove the unecessary 4th argument from `Codegen::new`
(#3640)
* feat(ast)!: make `Trivias` clonable by adding `Arc` (#3638)

### Features

- f6d9ca6 linter: Add `eslint/sort-imports` rule (#3568) (Wang Wenzhe)
- 129f91e span: Port over more methods from TextRange (#3592) (Don
Isaac)

### Bug Fixes

- f8f6d33 ast: Correct `visited_node` attr for strict mode of arrow fns
(#3635) (overlookmotel)
- e6ad3fb diagnostics: Do not print ansi color codes in non-TTYs (#3624)
(Boshen)
- d65202d span: Correct doc comments (#3608) (overlookmotel)
- 35e267b transformer: Arrow function transform use UIDs for `_this`
vars (#3634) (overlookmotel)
- 39bdebc transformer: Arrow func transform maintain scope ID (#3633)
(overlookmotel)
- 5cb7e6a transformer: Arrow func transform use correct spans (#3630)
(overlookmotel)
- 0c4ccb4 transformer: Arrow function transform alter `</this>` (#3627)
(overlookmotel)
- 8d237c4 transformer: JSX source calculate correct column when Unicode
chars (#3615) (overlookmotel)
- 9e8f4d6 transformer: Do not add `__source` for generated nodes (#3614)
(overlookmotel)
- 0fb4c35 transformer: Use UID for JSX source filename var (#3612)
(overlookmotel)

### Performance

- 3a59294 transformer: React display name transform reduce Atom
allocations (#3616) (overlookmotel)
- f4c1389 transformer: Create `Vec` with capacity (#3613)
(overlookmotel)

### Refactor

- 0f92521 ast: Replace recursion with loop (#3626) (overlookmotel)
- 08f1010 ast: Make `AstBuilder` `Copy` (#3602) (overlookmotel)
- 84304b4 linter: Add a `ctx.module_record()` method (#3637) (Boshen)
- f98f777 linter: Add rule fixer (#3589) (Don Isaac)
- e90e6a2 minifier: Make `Prepass` `Copy` (#3603) (overlookmotel)
- 7d61832 semantic: Pass `Rc` by value (#3586) (overlookmotel)
- 89bcbd5 transformer: Move `BoundIdentifier` into helpers (#3610)
(overlookmotel)
- 5793ff1 transformer: Replace `&’a Trivias` with `Rc<Trivias>` (#3580)
(Dunqing)
- 509871f transformer: Comment for unimplemented `spec` option in arrow
fns transform (#3618) (overlookmotel)
- 4b2e3a7 transformer: Fix indentation (#3617) (overlookmotel)
- 3467e3d transformer: Remove outdated comment (#3606) (overlookmotel)
- a799225 transformer: Flatten file structure for React transform
(#3604) (overlookmotel)
- 70f31a8 transformer: Reduce branching in JSX transform (#3596)
(overlookmotel)
- 3ae567d transformer: Remove dead code (#3588) (overlookmotel)
- 60cbdec traverse: `generate_uid_in_root_scope` method (#3611)
(overlookmotel)

Co-authored-by: Boshen <Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-transformer Area - Transformer / Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant