Commit graph

1051 commits

Author SHA1 Message Date
Boshen
0ba375899c
chore(tasks/benchmark): add isolated_declarations bench 2024-07-07 19:22:49 +08:00
Dunqing
54b3b6c0da
chore(benchmark): add isolated declarations (#4078) 2024-07-07 17:14:48 +08:00
mysteryven
4414774d7d chore(tasks/rulegen): generate options for fix cases (#4076)
Our fixer support rule option, and we need to generate `options` for them.

328445b4ca/crates/oxc_linter/src/tester.rs (L238)

cc @eryue0220
2024-07-07 03:01:55 +00:00
rzvxa
aa585d31e1
fix(ast_codegen, ast): visit ExpressionArrayElement as Expression. (#4061)
hotfix for #4060

I just added an edge case, We can come back to it later on and make it a
standard in our codegen.

The diff is big because it causes the code to reorder, The edge case
generated code doesn't follow the order in which they are defined in the
source of truth(eg `js.rs`)
2024-07-06 00:29:36 +08: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
Boshen
09cc760475
chore(tasks/benchmark): turn on jsdoc parsing in semantic benchmark 2024-07-04 00:00:52 +08:00
Boshen
243c9f35b0 refactor(parser): use function instead of trait to parse list with rest element (#4028)
closes #3887
2024-07-02 13:43:14 +00:00
rzvxa
1854a52bd7 feat(ast_codegen): introduce the #[span] hint. (#4012)
closes #3904
2024-07-02 10:18:58 +00:00
rzvxa
71e9286fa6 improvement(ast_codegen): use visit_as attribute to create aliased AstKinds. (#4011) 2024-07-02 10:18:56 +00:00
rzvxa
352c0b4103 pref(ast): inline visit walks with small bodies. (#4009)
~~Attempt to improve the performance of visitors, It is mostly for experiments. I'm not sure how much performance is there to gain back.~~

- [x] inline plural visits (eg: visit_statements)
- [x] inline enums when there are 5 or fewer match cases
- [x] inline structs when there are 5 or less fields
- [x] inline `Visit::alloc`
2024-07-02 10:18:55 +00:00
rzvxa
b51f75baf8 refactor(ast_codegen): no longer outputs discard variable for empty visitors. (#4008) 2024-07-02 10:18:53 +00:00
rzvxa
272df6ee90 feat(ast_codegen): support for generating VisitMut. (#4006) 2024-07-02 10:18:49 +00:00
rzvxa
7538af12d8 feat(ast_codegen): add visit generator (#3954)
~~The generated code is only here for the sake of my own comparison (instead of manually keeping a backup of the old generated file). I would clean this up as soon as it is ready, submit some parts of it as the down stack, and stack the actual generated code on top of this. So please don't let the huge diff distract you, It won't have many conflicts since almost all of these are the generated visit code, which is completely contained to its own module(other than some minor renaming refactors).~~

The order of function definitions is a bit different, I've used a depth-first search, We can switch to a breadth-first one to align functions more closely to the original.
2024-07-02 10:18:45 +00:00
Boshen
1dacb1fc5b
refactor(parser): use function instead of trait to parse delimited lists (#4014)
relates #3887

The rest of the list parsing trait implementations involves ... parsing
`rest`, which I'll refactor in another PR.
2024-07-02 14:47:56 +08:00
Dunqing
bdee156c5d fix(transformer/typescript): declare class incorrectly preserved as runtime class (#3997)
fix: #3993
2024-07-01 16:04:40 +00:00
Dunqing
a50ce3d299 fix(transformer/typescript): missing initializer for class constructor arguments with private and protected modifier (#3996)
close: #3992
2024-07-01 15:10:32 +00:00
Boshen
23038ad8f8 fix(codegen): print TSFunctionType inside TSTypeAssertion (#3999) 2024-07-01 14:44:35 +00:00
Boshen
1852ea4fd2
chore: clean up unused deps 2024-06-30 19:04:44 +08:00
Boshen
5845057bff refactor(transformer): pass in symbols and scopes (#3978)
This PR adds a new method `build_with_symbols_and_scopes` to make semantic building optional, there may be prior steps that has the semantic data already built.
2024-06-30 06:33:48 +00: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
rzvxa
71c07c59d7 improvement(ast_codegen): better output formatting. (#3932)
We use prettyplease for formatting our generated code, Which has a lot of advantages over rustfmt, But sometimes it conflicts with our cargo fmt config,
Since it isn't configurable I just added a `cargo fmt` step after the generation process to prevent conflicts.
We might be able to not rely on prettyplease at all, But We have to test that one after we have most of our generated code, rustfmt usually bails on nested calls and macros so it might not work as our only solution. In contrast to that prettyplease is used in both bindgen and cargo-expand and is created for this exact reason(formatting generated code).
2024-06-29 05:37:15 +00:00
DonIsaac
7b38bde073 feat(parser): parse modifiers with parse_modifiers (#3948)
Closes #3929
2024-06-29 05:29:47 +00:00
Dunqing
51e54f902c fix(codegen): should print TSModuleDeclarationKind instead of just module (#3957) 2024-06-29 05:24:36 +00:00
underfin
9e8709f06e
fix(sourcemap): should add tokens for unordered span (#3941)
close: https://github.com/oxc-project/oxc/issues/3843
2024-06-27 20:24:22 +08:00
Boshen
275349a9fe fix(parser): parse function type parameter name accessor (#3926)
fixes #3910
2024-06-26 13:34:24 +00:00
Boshen
3db2553dc2 refactor(parser): improve parsing of TypeScript type arguments (#3923) 2024-06-26 07:16:18 +00:00
Boshen
4cf3c7645f refactor(parser): improve parsing of TypeScript types (#3903)
- [x] fix everything
2024-06-26 05:58:16 +00:00
rzvxa
2e026e1b7f feat(ast_codegen): generate ast_kind.rs. (#3888)
[List of 68 blacklisted items](https://github.com/oxc-project/oxc/pull/3888/files#diff-59cbea4a1444e752992821d3429a5f27bf1027a530977d075ec89aa55995912aR11)
2024-06-25 15:47:04 +00:00
rzvxa
09f4d3c4d3 feat(ast_codegen): add ImplGetSpanGenerator. (#3852)
This one is ready to replace the handwritten module.
2024-06-25 14:39:39 +00:00
rzvxa
f6c4ec44ca feat(tasks/ast_codegen): prototype for codegen AST related code (#3815)
Part of https://github.com/oxc-project/oxc/issues/3819
2024-06-25 13:54:50 +00:00
Boshen
187f0782c1 refactor(parser): improve parsing of parse_function_or_constructor_type (#3892)
part of #3502
2024-06-25 03:43:02 +00:00
mysteryven
328445b4ca feat(linter): support vitest/no-disabled-tests (#3717) 2024-06-24 15:16:32 +00:00
Dunqing
ef82c78a72 fix(parser): trailing comma is not allowed in ParenthesizedExpression (#3885)
close: #3878

The implementation is copied from `SeparatedList`'s `print_list`.
```diff
    fn parse_list(&mut self, p: &mut ParserImpl<'a>) -> Result<()> {
        p.expect(self.open())?;

        let mut first = true;

        while !p.at(self.close()) && !p.at(Kind::Eof) {
            if first {
                first = false;
            } else {
                p.expect(self.separator())?;
-                if p.at(self.close()) {
-                    break;
-               }
            }

            self.parse_element(p)?;
        }

        p.expect(self.close())?;
        Ok(())
    }
```
2024-06-24 14:56:32 +00:00
renovate[bot]
0b41303d14
chore(deps): update npm packages (#3871)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pnpm](https://pnpm.io) ([source](https://togithub.com/pnpm/pnpm)) |
[`9.3.0` -> `9.4.0`](https://renovatebot.com/diffs/npm/pnpm/9.3.0/9.4.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.3.0/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.3.0/9.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [tar](https://togithub.com/isaacs/node-tar) | [`7.2.0` ->
`7.4.0`](https://renovatebot.com/diffs/npm/tar/7.2.0/7.4.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/tar/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tar/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tar/7.2.0/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tar/7.2.0/7.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>pnpm/pnpm (pnpm)</summary>

### [`v9.4.0`](https://togithub.com/pnpm/pnpm/compare/v9.3.0...v9.4.0)

[Compare Source](https://togithub.com/pnpm/pnpm/compare/v9.3.0...v9.4.0)

</details>

<details>
<summary>isaacs/node-tar (tar)</summary>

###
[`v7.4.0`](https://togithub.com/isaacs/node-tar/compare/v7.3.0...v7.4.0)

[Compare
Source](https://togithub.com/isaacs/node-tar/compare/v7.3.0...v7.4.0)

###
[`v7.3.0`](https://togithub.com/isaacs/node-tar/compare/v7.2.0...v7.3.0)

[Compare
Source](https://togithub.com/isaacs/node-tar/compare/v7.2.0...v7.3.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjQxMy4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-06-24 07:56:18 +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
f3a21a28d7
chore: do not compile test crates that have no tests 2024-06-24 00:20:04 +08:00
Boshen
13754cbd3d fix(parser): change diagnostic to "modifier cannot be used here" (#3853) 2024-06-23 15:14:27 +00:00
Boshen
ae09a97a09
refactor(ast)!: remove Modifiers from ts nodes (#3846) 2024-06-23 19:44:35 +08:00
Boshen
1af5ed3d89 refactor(ast)!: replace Modifiers with declare and const on EnumDeclaration (#3845) 2024-06-23 10:34:55 +00:00
Boshen
0673677317 refactor(ast)!: replace Modifiers with declare on Function (#3844) 2024-06-23 10:34:54 +00:00
Boshen
ee6ec4ee57 refactor(ast)!: replace Modifiers with declare and abstract on Class (#3841) 2024-06-23 10:34:53 +00:00
Boshen
9b38119ec9 refactor(ast)!: replace Modifiers with declare on VariableDeclaration (#3839)
part of #2958
2024-06-23 10:34:52 +00:00
Don Isaac
d5f6aeb1ca
feat(semantic): check for illegal symbol modifiers (#3838) 2024-06-23 12:36:09 +08:00
Boshen
445603444f feat(ast)!: add IdentifierReference to ExportSpecifier (#3820)
closes #3795
closes #3796
2024-06-22 11:43:41 +00:00
rzvxa
567334834b chore(ci): now we mark both ts alias and eslint rules. (#3813)
Fixes the unmarked implemented rules in #479.
2024-06-22 04:55:34 +00:00
overlookmotel
4f7ff7e3ad perf: do not pass &Atom to functions (#3818)
`Atom` is just a wrapper around `&str`, so better not to pass `&Atom` to functions, as that's a double-reference. Prefer `Atom` or `&str` instead to avoid indirection.
2024-06-22 04:48:00 +00:00
Boshen
8027b1e894 refactor(minifier): change prepass to ast_passes::remove_parens (#3801) 2024-06-21 07:18:08 +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
dc8e2b8dc0 feat(coverage/transpile): compare error message (#3789) 2024-06-20 10:13:36 +00:00