Dunqing
3987665490
fix(transformer/typescript): incorrect enum-related symbol_id/reference_id ( #4660 )
...
part of #4581
2024-08-06 02:57:19 +00:00
Dunqing
03c643a8af
fix(semantic): incorrect scope_id for catch parameter symbols ( #4659 )
...
When we move all the bindings in the CatchClause scope to its child scope (BlockStatement), we also need to replace the scope_id in the symbol with the scope_id of the new scope.
2024-08-06 02:57:18 +00:00
Dunqing
5327acdc1f
fix(transformer/react): the require IdentifierReference does not have a reference_id ( #4658 )
...
part of #4581 . Looks we had to pass `TraverseCtx` to the `ModuleImports`
2024-08-05 22:55:07 +00:00
Dunqing
4efd54b84d
fix(transformer/typescript): incorrect SymbolFlags for jsx imports ( #4549 )
...
All `SymbolFlags` for imports should be `SymbolFlags::Import`
2024-08-05 03:15:13 +00:00
Dunqing
3a6e4d91cf
feat(transformer_conformance): test ScopeTree and SymbolTable for correctness after transformation ( #4581 )
...
part of #4549
This test verifies that the correct symbols and scopes were added/changed during the transformation. From the snapshots, most of them are incorrect currently
2024-08-04 11:45:10 +00:00
Dunqing
a88d588a07
feat(semantic): add ReferenceFlags::TSTypeQuery to indicate referenced by TSTypeQuery ( #4317 )
...
`ReferenceFlags::TSTypeQuery` can be used to help us insist on whether the reference is referenced by the type or not.
2024-07-17 09:52:57 +00:00
Dunqing
c362bf7edf
fix(semantic): incorrect resolve references for TSInterfaceHeritage ( #4311 )
...
related issue: https://github.com/oxc-project/oxc/issues/3963
fixes: https://github.com/oxc-project/monitor-oxc/actions/runs/9960183591/job/27518854841
2024-07-17 03:33:02 +00:00
Dunqing
351ecf2707
fix(semantic): incorrect resolve references for TSTypeQuery ( #4310 )
...
```ts
type A = typeof Foo
^^^ Only allow reference to value symbol
```
I have verified the changed snapshot. That's correct
2024-07-17 03:33:00 +00:00
Boshen
e167ef79c6
fix(codegen): print parenthesis properly ( #4245 )
...
`TSParenthesizedType` handles parenthesis in ts types.
It should be considered a bug if parenthesis is not printed correctly after this PR.
2024-07-14 04:13:10 +00:00
Boshen
aaac2d8775
fix(codegen): preserve parentheses from AST instead calculating from operator precedence ( #4055 )
...
…operator precedence
Calculating from operator precedence is currently unsafe and will result
incorrect semantics.
2024-07-05 14:01:17 +08:00
DonIsaac
63f36daae0
feat(parser): parse modifiers with parse_modifiers (take 2) ( #3977 )
...
Same as #3948 , with fixes for bugs found by @Boshen.
2024-06-30 03:46:34 +00:00
Boshen
14bc31ee74
Revert "feat(parser): parse modifiers with parse_modifiers ( #3948 )"
...
This reverts commit 7b38bde073 .
2024-06-29 14:16:26 +08:00
DonIsaac
7b38bde073
feat(parser): parse modifiers with parse_modifiers ( #3948 )
...
Closes #3929
2024-06-29 05:29:47 +00:00
Dunqing
5501d5ce33
feat(transformer/typescript): transform import {} from "mod" to import "mod" ( #3866 )
...
close : #3736
2024-06-24 03:27:39 +00:00
Boshen
445603444f
feat(ast)!: add IdentifierReference to ExportSpecifier ( #3820 )
...
closes #3795
closes #3796
2024-06-22 11:43:41 +00:00
Boshen
2a16ce0624
feat(traverse): disable syntax check and disable build module record ( #3794 )
...
These can be skipped because :
* semantic errors are not passed to the caller
* module record is not used
2024-06-20 13:05:35 +00:00
Dunqing
497769cb60
feat(ast): add some visitor functions ( #3785 )
2024-06-20 05:23:04 +00:00
Boshen
5a99d30eba
feat(codegen): improve codegen formatting ( #3735 )
2024-06-18 11:10:36 +00:00
Boshen
c041e9d1a9
chore: bump test262, babel and TypeScript submodules ( #3644 )
2024-06-12 18:42:32 +08:00
Dunqing
e8a20f8d50
feat(transformer/typescript): remove typescript ast nodes ( #3559 )
...
According to Babel tests feedback, remove some known ts AST nodes.
There are still many TS AST nodes that need to be deleted
2024-06-07 05:04:22 +00:00
Dunqing
0007ee47be
chore(coverage, transformer_conformance): print all AST whether or not they are Typecript AST ( #3556 )
...
We have a conclusion that codegen will print whatever is in the AST,
instead of having an option to enable printing TypeScript syntax. I plan
to remove codegen's `enable_typescript` option after we strip out all
typescript AST in the transformer typescript plugin.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-06 15:45:20 +08:00
overlookmotel
837776e1ab
fix(transformer): TS namespace transform do not track var decl names ( #3501 )
...
Don't track variable declaration or import binding names in TS namespace transform.
Babel does, but it appears to be wrong. It's illegal to have a `var`/`let`/`const` declaration or import in same scope as a TS namespace declaration with same binding.
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAQTgMyhEcDkUCmBDAYxkwG4AoAOzxBwGcxCdE4BvAXzLIIgtvgCE4AXjgBGclRr1GcQSzJxFcADY54AD3Icyq+AGFhYidToMCTA-KUq1cTWW0A3PFDgARQ+Monp596wUlXTstMiA
2024-06-03 12:35:57 +00:00
Dunqing
b4fd1ad31c
fix(transformer/typescript): variable declarations are not created when a function has a binding with the same name ( #3460 )
2024-05-29 23:00:22 +00:00
Dunqing
1a50b86281
refactor(typescript/namespace): reuse TSModuleBlock's scope id ( #3459 )
2024-05-29 23:00:15 +00:00
overlookmotel
90b0f6da81
fix(transformer): use UIDs for React imports ( #3431 )
...
Use UIDs for local var names for React JSX imports e.g. `_jsx` in
`import { jsx as _jsx } from "react/jsx-runtime";`.
2024-05-29 18:32:10 +08:00
Dunqing
6a1f2c21df
chore(transform_conformance): skip some test cases ( #3449 )
2024-05-28 13:38:03 +00:00
Dunqing
92df98b005
feat(transformer/typescript): report error that do not allow namespaces ( #3448 )
2024-05-28 13:38:01 +00:00
Dunqing
a6b073a47c
feat(transformer/typescript): report error for namespace exporting non-const ( #3447 )
2024-05-28 13:38:00 +00:00
Dunqing
150255c704
feat(transformer/typescript): if within a block scope, use let to declare enum name ( #3446 )
2024-05-28 13:37:58 +00:00
Dunqing
e80552c797
feat(transformer/typescript): if binding exists, variable declarations are not created for namespace name ( #3445 )
2024-05-28 13:37:57 +00:00
Dunqing
816a782254
feat(transformer): support targets option of preset-env ( #3371 )
...
The implementation of the `targets` options was copied from
[swc](https://github.com/swc-project/swc/tree/main/crates/preset_env_base ),
which resulted in some added dependencies in transformer.
Currently, it has supported enabling plugins by `targets`
2024-05-27 10:33:40 +08:00
Dunqing
241e8d1899
feat(transformer/typescript): if the binding exists, the identifier reference is not renamed ( #3387 )
...
Related:
https://github.com/oxc-project/oxc/discussions/3251#discussioncomment-9528247
2024-05-27 01:00:04 +00:00
overlookmotel
d4371e8f95
fix(transformer): use UIDs in TS namespace transforms ( #3395 )
...
Use the `TraverseCtx::generate_uid` method introduced in #3395 to fix
some of the TS namespace test cases.
But... I honestly have no idea what I'm doing here!
I am running up against a combination of 3 different areas where I know
very little:
1. I am unfamiliar with `Semantic`.
2. I am unfamiliar with Oxc's conventions for writing transforms.
3. I don't "speak" Typescript!
This PR should not be merged as is. I'm pretty sure it's wrong. I've
done it mostly just to test out `generate_uid`.
In particular:
1. Is `SymbolFlags::FunctionScopedVariable` the right flags to use in
all cases here?
2. `generate_uid` creates a symbol, and registers a binding for it in
the scope tree. So if there are any branches in this logic where `name`
doesn't actually get used after `generate_uid` is called, then it's not
right.
3. Identifiers which are added to AST should also have corresponding
`ReferenceId`s created for them (but I imagine this is also missing in
many other places in the transformer).
On point 2: We could split up `generate_uid` into 2 functions. One
function would find a valid UID name *but not register a binding for
it*. If you want to actually use that name, you'd call a 2nd function to
generate the binding. Would that be a better API?
Could someone help me out to progress this please?
(Sorry my lack of knowledge is a bit useless here. I will learn all
these things in time, but just trying to be honest about where I'm at
right now. I'm sure I could figure it out myself, but it would take me
hours, whereas others will probably look at it and know what to do in
about 5 mins.)
2024-05-27 08:53:13 +08:00
Dunqing
e2c6fe0cb1
feat(transformer): report errors when options have unknown fields ( #3322 )
2024-05-19 01:19:40 +08:00
Dunqing
8ff1ffba74
feat(transformer_conformance): skip some tests that are known to fail ( #3293 )
...
I don't think we need to be completely consistent with Babel's output.
Because Babel's output doesn't always make sense.
2024-05-15 22:06:00 +08:00
Dunqing
b9d69ad665
feat(transformer): do not add self attribute in react/jsx plugin ( #3287 )
...
follow-up: https://github.com/oxc-project/oxc/pull/3258 .
2024-05-15 17:59:57 +08:00
Dunqing
b4fa27a2ee
fix(transformer): do no add __self when the jsx is inside constructor ( #3258 )
2024-05-14 16:12:49 +01:00
Boshen
530455849b
chore(tasks): add commit sha to snapshots to make sure submodules are not outdated ( #3267 )
...
If submodules are outdated, it'll panic with the following message
```
Repository is outdated, please run `just submodules` to update it.
```
For us maintainers, we'll need the env `UPDATE_SNAPSHOT` to force an update.
2024-05-14 10:18:00 +00:00
Dunqing
eefb66f750
feat(ast): add type to AccessorProperty to support TSAbractAccessorProperty ( #3256 )
2024-05-13 12:35:58 +00:00
Dunqing
34dd53cc98
feat(transformer): report ambient module cannot be nested error ( #3253 )
2024-05-13 07:51:06 +00:00
Boshen
09f34fc942
refactor(semantic): unify diagnostic in checker
2024-05-12 01:07:28 +08:00
Boshen
7067f9c646
refactor(transformer): clean up more diagnostics
2024-05-12 00:57:58 +08:00
Dunqing
1b29e63300
feat(transformer): do not elide jsx imports if a jsx element appears somewhere ( #3237 )
2024-05-11 15:00:26 +00:00
Dunqing
fd6a1aa1d2
feat(transformer_conformance): correct source type ( #3233 )
2024-05-11 09:30:43 +00:00
Dunqing
6ac8a8479e
fix(transformer): correctly jsx-self inside arrow-function ( #3224 )
2024-05-11 00:48:18 +00:00
Dunqing
18d853bb2b
feat(transformer/react): support development mode ( #3143 )
2024-05-10 22:07:33 +08:00
Dunqing
0ba7778e5e
fix(parser): correctly parse cls.fn<C> = x ( #3208 )
...
close : #3206
2024-05-09 10:23:45 +08:00
overlookmotel
9590eb0cf4
fix(transform): implement transform-react-display-name with bottom-up lookup ( #3183 )
...
Sliced off from #3152 .
Re-implement `transform-react-display-name` using bottom-up lookup
provided by `Traverse` trait.
This fixes the 1 remaining failing test case for this plugin (see
#2937 ).
`Traverse` is not complete yet (see #3182 ), so this is also not ready to
merge yet.
2024-05-08 15:33:39 +00:00
Dunqing
a227050ed0
chore: update babel repo ( #3205 )
2024-05-08 20:15:15 +08:00
Boshen
d76507699d
chore(transform_conformance): skip transform-destructuring ( #3136 )
2024-04-30 00:09:22 +08:00