overlookmotel
4fd89e8eed
test(transformer): fix indentation in transformer test fixtures ( #6346 )
...
Unimportant nit. Fix whitespace in the transformer test fixtures.
2024-10-08 01:32:07 +00:00
overlookmotel
cf20f3a89d
feat(transformer): exponentiation transform: support private fields ( #6345 )
...
Babel doesn't support private fields in this transform, but there's no reason not to. So we can.
2024-10-08 01:32:06 +00:00
overlookmotel
4aa4e6bec0
refactor(transformer): exponentiation transform: do not wrap in SequenceExpression if not needed ( #6343 )
...
`left **= right` is transformed to `left = Math.pow(left, right)`. There is no need to wrap it in a `SequenceExpression`.
2024-10-08 01:32:05 +00:00
overlookmotel
2bcd12a868
fix(transformer): exponentiation transform: fix reference flags ( #6330 )
2024-10-07 10:35:34 +00:00
overlookmotel
28cbfa7c64
fix(transformer): exponentiation transform: fix temp var names ( #6329 )
...
Fix one case that I missed in #6318 .
2024-10-07 09:00:35 +00:00
overlookmotel
3a4bcc77fc
fix(transformer): exponentiation transform: fix temp var names ( #6318 )
...
Make naming of temp vars follow Babel. It wasn't apparent that our version of this transform was behaving differently from Babel because the Babel plugin has very few tests. The added tests replicate Babel's output.
2024-10-06 23:08:10 +00:00
overlookmotel
ccb7bdcc56
fix(transformer): exponentiation transform: do not replace object when private property ( #6313 )
...
Fix exponentiation operator transform to bail out early if a private class property.
We can't transform this:
```js
class C {
#p;
method() {
this.#p **= 2;
}
}
```
But we should at least leave it alone. Previously `get_obj_ref` called `ast.move_expression(expr)` on the member expression's object before bailing out, so example above was transformed to:
```js
class C {
#p;
method() {
null.#p **= 2; // <-- `null`
}
}
```
This PR makes it spot this case early and bail out *before* calling `ast.move_expression(expr)`.
2024-10-06 23:08:08 +00:00
Boshen
020bb80b65
refactor(codegen)!: change to CodegenReturn::code and CodegenReturn::map ( #6310 )
2024-10-06 05:05:47 +00:00
overlookmotel
bd81c5134c
fix(transformer): exponentiation transform: fix duplicate symbols ( #6300 )
...
Identifier was being cloned unnecessarily, creating an extra symbol.
2024-10-06 00:51:28 +00:00
Boshen
8729755baa
feat(oxc,napi/transform): napi/transform use oxc compiler pipeline ( #6298 )
...
part of #6156
2024-10-05 16:35:09 +00:00
overlookmotel
409dffc8ab
refactor(traverse)!: generate_uid return a BoundIdentifier ( #6294 )
...
Closes #5020 .
`TraverseCtx::generate_uid` and associated methods return a `BoundIdentifier`, containing both symbol ID and name. This reduces boilerplate code for the caller and avoids and unnecessary lookup to get the name.
Also add a couple of helper methods to `BoundIdentifier` to reduce boilerplate further.
2024-10-05 16:00:50 +00:00
overlookmotel
06797b6900
fix(transformer): logical assignment operator transform: fix reference IDs ( #6289 )
2024-10-05 14:48:37 +00:00
overlookmotel
e19deaa102
ci(transformer): move post-transform checker to tasks crate ( #6288 )
...
Move post-transform checker into a `tasks` crate. It doesn't feel like it belongs in `oxc_semantic`. It also feels like too heavy a lump of code to put in `tasks/common`.
2024-10-05 14:48:37 +00:00
overlookmotel
0f5afd7ede
test(transformer): transform checker output symbol name for mismatches ( #6286 )
...
Transform checker include symbol names in output for symbol mismatches. This is rather more helpful for locating bugs than just `SymbolId(3)`.
2024-10-05 14:42:06 +00:00
overlookmotel
21b08ba141
refactor(transformer): shared VarDeclarations ( #6170 )
...
First step towards #5049 .
Various transforms need to add a `var` statement at top of enclosing statement block.
e.g.:
```js
// Input
a ??= b;
```
```js
// Output
var _a;
(_a = a) !== null && _a !== void 0 ? _a : (a = b);
```
Each of these transforms previously maintained it's own stack and added `var` statements individually.
Share this functionality in a "common" utility transform which maintains a single stack to serve them all.
2024-09-30 03:53:00 +00:00
Dunqing
bfd19882b0
fix(transformer/react): should not collect use-hooks if it's a nested member expression ( #6143 )
...
close : #6139
I still remember this logic and I call `get_first_object` for it intentionally 🥲
2024-09-28 14:38:14 +00:00
DonIsaac
b1af73db81
fix(semantic): do not create a global symbol for declare global {} ( #6040 )
...
Re-creation of #6004 to unblock it from down-stack PRs. @Boshen has already reviewed the previous PR and determined this to be correct behavior.
2024-09-25 08:46:00 +00:00
Boshen
28da77195b
feat(transformer): do not transform ** with bigint literals ( #6023 )
...
part of #5822
They will produce runtime errors.
2024-09-24 10:33:02 +00:00
overlookmotel
4e9e838838
fix(transformer): fix arrow function transform ( #5933 )
...
Fix arrow function transform's treatment of `this` within classes.
2024-09-21 07:48:18 +00:00
overlookmotel
15743344b1
test(transformer): add test for arrow function transform ( #5932 )
...
Add test for `this` in nested block inside arrow function.
2024-09-21 00:53:43 +00:00
Boshen
6757c5829f
chore(transform_conformance): remove unused snapshots/typescript.snap.md
...
closes #5922
2024-09-20 22:41:41 +08:00
overlookmotel
bd318b1eec
test(transformer): join paths in cross-platform compatible way ( #5920 )
2024-09-20 11:30:12 +00:00
overlookmotel
7d32d2086c
test(transformer): update transform conformance README ( #5919 )
...
Add reference to our additional tests + tidy up capitalization.
2024-09-20 11:46:44 +01:00
overlookmotel
9dac6dfb23
test(transformer): move transformer conformance snapshots into separate directory ( #5917 )
...
Move snapshots for transform conformance into a `snapshots` sub-folder.
2024-09-20 10:25:17 +00:00
overlookmotel
4d5c4f6cad
fix(transformer): fix reference flags in logical assignment operator transform ( #5903 )
2024-09-20 01:26:55 +00:00
overlookmotel
d335a6760e
fix(transformer): fix references in logical assignment operator transform ( #5896 )
...
Re-use existing reference, rather than creating a new one.
2024-09-20 01:26:53 +00:00
overlookmotel
cab441c572
test(transformer): fix JSX test options ( #5895 )
...
Fix a test by setting correct options.
2024-09-20 01:26:52 +00:00
overlookmotel
9758c1a5cc
fix(transformer): JSX source: add var _jsxFileName statement ( #5894 )
...
Fix JSX source transform when run alone without main JSX transform.
The added test case is same as one of Babel's exec test cases, but the exec test fails due to `transformAsync` not being present.
2024-09-20 01:26:52 +00:00
overlookmotel
0c8733df23
test(transformer): clean up identation in test fixtures ( #5863 )
...
Not sure how added up with mix of tabs and spaces.
2024-09-18 15:19:59 +00:00
overlookmotel
ef8dcc9d4d
test(transformer): more tests for arrow function transform ( #5849 )
2024-09-18 09:46:58 +00:00
overlookmotel
49ee1dcff2
fix(transformer): arrow function transform handle this in arrow function in class static block ( #5848 )
...
Class static blocks also hold a `this` binding.
2024-09-18 09:46:57 +00:00
Boshen
213dbc04ff
chore(transform_conformance): do not print comments yet ( #5788 )
2024-09-15 15:48:58 +00:00
Dunqing
36e698b411
perf(transformer): call transform_jsx in exit_expression rather than enter_expression ( #5751 )
...
### Difference
In `enter_expression`: Recursive transform JSX
In `exit_expression`: Deep first transform
After the change, `transform_jsx` still has a lot of room for improvement.
2024-09-13 17:58:41 +00:00
Dunqing
3cc38dfc05
fix(transformer/react): react refresh panics when encounter use hook ( #5768 )
...
close : #5766
I even forgot that React has a `use` hook in the latest version
2024-09-13 16:17:33 +00:00
Dunqing
77d9170f84
fix(transformer/react): isStaticChildren should be false when there is only one child ( #5745 )
...
We found a warning report [here](206df66e70/packages/react/src/jsx/ReactJSXElement.js (L614-L632) ). It caused by we transform incorrectly
2024-09-13 13:20:59 +00:00
Dunqing
c9fea5dd16
chore(tasks/transformer_conformance): remove an ignored test that has passed ( #5750 )
2024-09-13 09:03:48 +00:00
dalaoshu
d18c896a2c
perf(rust): use cow_utils instead ( #5664 )
...
Related to #5586 and #5662
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-11 18:39:30 +08:00
Dunqing
a1afd48c68
fix(transformer/react): incorrect scope_id for var hoisted in fast refresh plugin ( #5695 )
...
Fix the last one semantic error in the fast react plugin
2024-09-11 09:02:29 +00:00
Dunqing
f2f5e5aaf5
fix(transformer/react): missing scope_id for function in fast refresh plugin ( #5693 )
...
Fix semantic error in the fast react plugin
2024-09-11 09:02:28 +00:00
Dunqing
a891c31889
fix(transformer/react): refresh plugin has incorrect reference flags ( #5656 )
...
As you see the diff
2024-09-11 07:57:17 +00:00
Dunqing
ffbc4625b4
chore(transformer): treat all React Refresh tests as ESM syntax ( #5644 )
...
related: #5612
2024-09-11 07:57:17 +00:00
Dunqing
3e8b96f165
fix(transformer/react): the refresh plugin cannot handle member expressions with React hooks ( #5655 )
...
The previous implementation doesn't handle nested StaticMemberExpression. For example: `A.B.C.useHook`.
2024-09-11 07:57:16 +00:00
Dunqing
7b543dffd9
feat(transformer/react): handle refresh_sig and refresh_reg options correctly ( #5638 )
...
In previous implementations, even if pass `import.meta.xxxx` into these options this plugin still treats them as `IdentifierReference`
2024-09-11 07:57:15 +00:00
Dunqing
3bf6aaf06a
fix(transformer/react): support emit_full_signatures option in refresh plugin ( #5629 )
2024-09-11 07:57:14 +00:00
Dunqing
36d864a0c3
fix(transformer/react): don't transform if the variable does not have a value reference ( #5528 )
...
close : #4746
Solved the last two tests, but it's a coincidence. I've added a test to cover it.
2024-09-11 07:10:55 +00:00
Boshen
f49e6ebd41
fix(span): treat .js as module file (reverts the previous breaking change) ( #5612 )
...
As it turns out it's not ideal to treat `.js` as `script` in today's world anymore.
This makes https://github.com/oxc-project/oxlint-ecosystem-ci pass again.
2024-09-08 15:14:04 +00:00
Boshen
63a830e08c
chore(dprint): format toml files ( #5599 )
...
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
Boshen
919d17fc5c
fix(transform_conformance): only print semantic mismatch errors when output is correct ( #5589 )
...
closes #5166
Had to rerun for mismatch errors :-/
2024-09-07 16:32:53 +00:00
overlookmotel
505d06446b
fix(transformer): JSX transform delete references for JSXClosingElements ( #5560 )
...
JSX transform delete old references which were used in `JSXClosingElement` before transformation.
2024-09-07 03:51:36 +00:00
overlookmotel
87a79d9cd0
test(transformer): add trailing line breaks to conformance fixtures ( #5537 )
...
Currently whether conformance fixture files have trailing line breaks is inconsistent - some have them, some don't. Make all of them have a trailing line break.
2024-09-06 12:02:46 +00:00