github-actions[bot]
2a169d1969
Release crates v0.20.0 ( #4189 )
...
## [0.20.0] - 2024-07-11
- 5731e39 ast: [**BREAKING**] Store span details inside comment struct
(#4132 ) (Luca Bruno)
### Features
- 67fe75e ast, ast_codegen: Pass the `scope_id` to the `enter_scope`
event. (#4168 ) (rzvxa)
- 54cd04a minifier: Implement dce with var hoisting (#4160 ) (Boshen)
- 44a894a minifier: Implement return statement dce (#4155 ) (Boshen)
- 725571a napi/transformer: Add `jsx` option to force parsing with jsx
(#4133 ) (Boshen)
### Bug Fixes
- 48947a2 ast: Put `decorators` before everything else. (#4143 ) (rzvxa)
- 7a059ab cfg: Double resolution of labeled statements. (#4177 ) (rzvxa)
- 4a656c3 lexer: Incorrect lexing of large hex/octal/binary literals
(#4072 ) (DonIsaac)
- 28eeee0 parser: Fix asi error diagnostic pointing at invalid text
causing crash (#4163 ) (Boshen)
### Performance
- ddfa343 diagnostic: Use `Cow<'static, str>` over `String` (#4175 )
(DonIsaac)
- 2203143 semantic: Store unresolved refs in a stack (#4162 ) (lucab)
- fca9706 semantic: Faster search for leading comments (#4140 ) (Boshen)
### Documentation
- bdcc298 ast: Update the note regarding the `ast_codegen` markers.
(#4149 ) (rzvxa)
### Refactor
- 03ad1e3 semantic: Tweak comment argument type (#4157 ) (lucab)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-11 11:05:49 +08:00
rzvxa
48947a26d2
fix(ast): put decorators before everything else. ( #4143 )
...
Won't fix #4142
It is similar to #3994 but for those types that weren't relying on this order. It seems to be the right order.
technically speaking it is a breaking change but I know as a fact that it won't have a big difference on our downstream. If you want it to be chronically correct feel free to merge as a breaking change.
2024-07-10 02:03:05 +00:00
Luca Bruno
5731e3957f
refactor(ast)!: store span details inside comment struct ( #4132 )
...
This tweaks `Comment` definition in order to internally store the start
and end position of its span.
Closes: https://github.com/oxc-project/oxc/issues/4069
2024-07-09 23:23:43 +08:00
github-actions[bot]
714bf1dd7f
Release crates v0.19.0 ( #4137 )
...
## [0.19.0] - 2024-07-09
- b936162 ast/ast_builder: [**BREAKING**] Shorter allocator utility
method names. (#4122 ) (rzvxa)
### Features
- 485c871 ast: Allow conversion from `Expression` into `Statement` with
`FromIn` trait. (#4124 ) (rzvxa)
### Refactor
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-09 20:32:06 +08:00
rzvxa
b936162093
refactor(ast/ast_builder)!: shorter allocator utility method names. ( #4122 )
...
This PR serves two purposes, First off it would lower the amount of characters we have to type in for a simple operation such as wrapping an expression in a vector. Secondly, it would follow the generated names more closely since nowhere else in the builder we do have `new_xxx`, We always say `xxx` since a builder always constructs something.
```
new_vec -> vec
new_vec_single -> vec1*
new_vec_from_iter -> vec_from_iter
new_vec_with_capacity -> vec_with_capacity
new_str -> str
new_atom -> atom
```
`*` This one is the main motivation behind this PR, It saves 10 characters!
2024-07-09 12:16:38 +00:00
github-actions[bot]
e29cdbfe40
Release crates v0.18.0 ( #4136 )
...
## [0.18.0] - 2024-07-09
- d347aed ast: [**BREAKING**] Generate `ast_builder.rs`. (#3890 ) (rzvxa)
### Features
- c6c16a5 minifier: Dce all conditional expressions (#4135 ) (Boshen)
- 365d9ba oxc_codegen: Generate annotation comments before
`CallExpression` and `NewExpression` (#4119 ) (IWANABETHATGUY)
- 3a0f2aa parser: Check for illegal modifiers in modules and namespaces
(#4126 ) (DonIsaac)
- 2f53bdf semantic: Check for abstract ClassElements in non-abstract
classes (#4127 ) (DonIsaac)
- c4ee9f8 semantic: Check for abstract initializations and
implementations (#4125 ) (Don Isaac)
- 44c7fe3 span: Add various implementations of `FromIn` for `Atom`.
(#4090 ) (rzvxa)
### Bug Fixes
- cb1af04 isolated-declarations: Remove the `async` and `generator`
keywords from `MethodDefinition` (#4130 ) (Dunqing)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-09 19:56:10 +08:00
rzvxa
d347aedfda
feat(ast)!: generate ast_builder.rs. ( #3890 )
...
### Every structure has 2 builder methods:
1. `xxx` e.g. `block_statement`
```rust
#[inline]
pub fn block_statement(self, span: Span, body: Vec<'a, Statement<'a>>) -> BlockStatement<'a> {
BlockStatement { span, body, scope_id: Default::default() }
}
```
2. `alloc_xxx` e.g. `alloc_block_statement`
```rust
#[inline]
pub fn alloc_block_statement(
self,
span: Span,
body: Vec<'a, Statement<'a>>,
) -> Box<'a, BlockStatement<'a>> {
self.block_statement(span, body).into_in(self.allocator)
}
```
### We generate 3 types of methods for enums:
1. `yyy_xxx` e.g. `statement_block`
```rust
#[inline]
pub fn statement_block(self, span: Span, body: Vec<'a, Statement<'a>>) -> Statement<'a> {
Statement::BlockStatement(self.alloc(self.block_statement(span, body)))
}
```
2. `yyy_from_xxx` e.g. `statement_from_block`
```rust
#[inline]
pub fn statement_from_block<T>(self, inner: T) -> Statement<'a>
where
T: IntoIn<'a, Box<'a, BlockStatement<'a>>>,
{
Statement::BlockStatement(inner.into_in(self.allocator))
}
```
3. `yyy_xxx` where `xxx` is inherited e.g. `statement_declaration`
```rust
#[inline]
pub fn statement_declaration(self, inner: Declaration<'a>) -> Statement<'a> {
Statement::from(inner)
}
```
------------
### Generic parameters:
We no longer accept `Box<'a, ADT>`, `Atom` or `&'a str`, Instead we use `IntoIn<'a, Box<'a, ADT>>`, `IntoIn<'a, Atom<'a>>` and `IntoIn<'a, &'a str>` respectively.
It allows us to rewrite things like this:
```rust
let ident = IdentifierReference::new(SPAN, Atom::from("require"));
let number_literal_expr = self.ast.expression_numeric_literal(
right_expr.span(),
num,
raw,
self.ast.new_str(num.to_string().as_str()),
NumberBase::Decimal,
);
```
As this:
```rust
let ident = IdentifierReference::new(SPAN, "require");
let number_literal_expr = self.ast.expression_numeric_literal(
right_expr.span(),
num,
raw,
num.to_string(),
NumberBase::Decimal,
);
```
2024-07-09 00:57:26 +00:00
github-actions[bot]
c3f08ce8e0
Release crates v0.17.2 ( #4115 )
...
## [0.17.2] - 2024-07-08
### Features
- 115ac3b allocator: Introduce `FromIn` and `IntoIn` traits. (#4088 )
(rzvxa)
- 720983a napi/transform: Allow setting `sourceType` to `transform`
(#4113 ) (Boshen)
- e386b62 semantic: Check for invalid type import assignments (#4097 )
(DonIsaac)
### Bug Fixes
- 5472b7c codegen: 256 indentations level is not enough for codegen
(Boshen)
- 5c31236 isolated-declarations: Keep literal value for readonly
property (#4106 ) (Dunqing)
- e67c7d1 isolated-declarations: Do not infer type for private
parameters (#4105 ) (Dunqing)
- 3fcad5e isolated_declarations: Remove nested AssignmentPatterns from
inside parameters (#4077 ) (michaelm)
- f8d77e4 isolated_declarations: Infer type of template literal
expressions as string (#4068 ) (michaelm)
- 0f02608 semantic: Bind `TSImportEqualsDeclaration`s (#4100 ) (Don
Isaac)
- 4413e2d transformer: Missing initializer for readonly consructor
properties (#4103 ) (Don Isaac)
### Performance
- 7ed27b7 isolated-declarations: Use `FxHashSet` instead of `Vec` to
speed up the `contain` (#4074 ) (Dunqing)
- 9114c8e semantic: Keep a single map of unresolved references (#4107 )
(Luca Bruno)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-08 19:16:33 +08:00
Don Isaac
4413e2d298
fix(transformer): missing initializer for readonly consructor properties ( #4103 )
2024-07-08 12:45:50 +08:00
github-actions[bot]
51d56d37ff
Release crates v0.17.1 ( #4075 )
...
## [0.17.1] - 2024-07-06
### Bug Fixes
- aa585d3 ast_codegen, ast: Visit `ExpressionArrayElement` as
`Expression`. (#4061 ) (rzvxa)
- 564a75a codegen: Missing TypeParameters in TSConstructSignature
(#4063 ) (michaelm)
- adee728 isolated_declarations: Don't report an error for parameters if
they are ObjectPattern or ArrayPattern with an explicit type (#4065 )
(michaelm)
- 1b8f208 isolated_declarations: Correct emit for private static methods
(#4064 ) (michaelm)
- 719fb96 minifier: Omit dce `undefined` which can be a shadowed
variable (#4073 ) (Boshen)
- 150f4d9 napi/transform: Display error with spanned messages (Boshen)
### Performance
- 7fe2a2f parser: Do not copy comments (#4067 ) (overlookmotel)
### Refactor
- 8fa98e0 ast: Inline trivial functions and shorten code (#4066 )
(overlookmotel)
- 65aee19 isolated-declarations: Reorganize scope tree (#4070 ) (Luca
Bruno)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-07 01:29:52 +08:00
github-actions[bot]
224f5ef2cc
Release crates v0.17.0 ( #4059 )
...
## [0.17.0] - 2024-07-05
- e32b4bc ast: [**BREAKING**] Store trivia comments in a sorted slice
(#4045 ) (Luca Bruno)
- 1df6ac0 ast: [**BREAKING**] Rename `visit_enum_memeber` to
`visit_ts_enum_member`. (#4000 ) (rzvxa)
- 4a0eaa0 ast: [**BREAKING**] Rename `visit_enum` to
`visit_ts_enum_declaration`. (#3998 ) (rzvxa)
- c98d8aa ast: [**BREAKING**] Rename `visit_arrow_expression` to
`visit_arrow_function_expression`. (#3995 ) (rzvxa)
### Features
- 1854a52 ast_codegen: Introduce the `#[span]` hint. (#4012 ) (rzvxa)
- 7538af1 ast_codegen: Add visit generator (#3954 ) (rzvxa)
- 7768d23 isolated-declarations: Support optional class methods (#4035 )
(Egor Blinov)
- 0da9dfb minifier: Add constant folding to remove dead code (#4058 )
(Boshen)
### Bug Fixes
- aaac2d8 codegen: Preserve parentheses from AST instead calculating
from operator precedence (#4055 ) (Boshen)
- 5e5b1b1 codegen: Correct accessibility emit for class
formal-parameters/methods/properties (#4042 ) (Egor Blinov)
- 7844734 codegen: Missing const keyword in TSTypeParamter (#4022 )
(Dunqing)
- 6254a41 codegen: Missing TypeParamters in TSCallSignature (#4021 )
(Dunqing)
- 3d29e9c isolated-declarations: Eliminate imports incorrectly when they
are used in `TSInferType` (#4043 ) (Dunqing)
- 02ea19a isolated-declarations: Should emit `export {}` when only
having `ImportDeclaration` (#4026 ) (Dunqing)
- 7c915f4 isolated-declarations: Binding elements with export should
report an error (#4025 ) (Dunqing)
- 05a047c isolated-declarations: Method following an abstract method
gets dropped (#4024 ) (Dunqing)
- c043bec isolated_declarations: Add mapped-type constraint to the scope
(#4037 ) (Egor Blinov)
- b007553 isolated_declarations: Fix readonly specifier on class
constructor params (#4030 ) (Egor Blinov)
- da62839 isolated_declarations: Inferring literal types for readonly
class fileds (#4027 ) (Egor Blinov)
### Refactor
- b51f75b ast_codegen: No longer outputs discard variable for empty
visitors. (#4008 ) (rzvxa)
- edb557c minifier: Add a folder struct for constant folding (#4057 )
(Boshen)
- 243c9f3 parser: Use function instead of trait to parse list with rest
element (#4028 ) (Boshen)
- 1dacb1f parser: Use function instead of trait to parse delimited lists
(#4014 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-05 15:46:50 +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
rzvxa
cd1e9bde7f
improvement(ast): generate visit_mut.rs. ( #4007 )
2024-07-02 10:18:51 +00:00
github-actions[bot]
e2c9015ef6
Release crates v0.16.3 ( #4013 )
...
## [0.16.3] - 2024-07-02
### Features
- b257d53 linter: Support report
`@typescript-eslint/consistent-type-imports` (#3895 ) (mysteryven)
### Bug Fixes
- 23038ad codegen: Print `TSFunctionType` inside `TSTypeAssertion`
(#3999 ) (Boshen)
- d995f94 semantic: Resolve reference incorrectly when a parameter
references a parameter that hasn't been defined yet (#4004 ) (Dunqing)
- bdee156 transformer/typescript: `declare class` incorrectly preserved
as runtime class (#3997 ) (Dunqing)
- a50ce3d transformer/typescript: Missing initializer for class
constructor arguments with `private` and `protected` modifier (#3996 )
(Dunqing)
### Refactor
- 0fe22a8 ast: Reorder fields to reflect their visit order. (#3994 )
(rzvxa)
- d0eac46 parser: Use function instead of trait to parse normal lists
(#4003 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-07-02 12:47:29 +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
github-actions[bot]
3870ed5a24
Release crates v0.16.2 ( #3983 )
...
## [0.16.2] - 2024-06-30
### Features
- dc6d45e ast,codegen: Add `TSParenthesizedType` and print type
parentheses correctly (#3979 ) (Boshen)
- 63f36da parser: Parse modifiers with `parse_modifiers` (take 2)
(#3977 ) (DonIsaac)
### Bug Fixes
- dac617d codegen: Print some missing typescript attributes (#3980 )
(Boshen)
- bd1141d isolated-declarations: If declarations is referenced in
`declare global` then keep it (#3982 ) (Dunqing)
### Performance
- b234ddd semantic: Only check for jsdoc if jsdoc building is enabled
(Boshen)
- 1eac3d2 semantic: Use `Atom<'a>` for `Reference`s (#3972 ) (Don Isaac)
- 0c81fbe syntax: Use `NonZeroU32` for `SymbolId` and `ReferenceId`
(#3970 ) (Boshen)
### Refactor
- 5845057 transformer: Pass in symbols and scopes (#3978 ) (Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-30 19:59:15 +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
Boshen
54c653ebd4
Revert "perf(semantic): use Atom<'a> for References" ( #3974 )
...
Reverts oxc-project/oxc#3972
@DonIsaac As it turns out we can't have lifetimes on these structures because semantic data is exposed to downstream users to use freely, detached from the ast and allocator.
2024-06-29 15:55:04 +00:00
Don Isaac
1eac3d244d
perf(semantic): use Atom<'a> for References ( #3972 )
...
Relates to [this
issue](https://github.com/oxc-project/backlog/issues/31 ) on the backlog.
2024-06-29 23:23:36 +08:00
github-actions[bot]
fa50e9737e
Release crates v0.16.1 ( #3968 )
...
## [0.16.1] - 2024-06-29
### Features
- 7b38bde parser: Parse modifiers with `parse_modifiers` (#3948 )
(DonIsaac)
- f64ad4b semantic: Make jsdoc building optional (turned off by default)
(#3955 ) (Boshen)
### Bug Fixes
- 51e54f9 codegen: Should print `TSModuleDeclarationKind` instead of
just `module` (#3957 ) (Dunqing)
- 31e4c3b isolated-declarations: `declare global {}` should be kept even
if it is not exported (#3956 ) (Dunqing)
### Refactor
- 2705df9 linter: Improve diagnostic labeling (#3960 ) (DonIsaac)
- 15ec254 semantic: Remove the unused `Semantic::build2` function
(Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-29 16:53:09 +08:00
DonIsaac
2705df93b3
refactor(linter): improve diagnostic labeling ( #3960 )
2024-06-29 05:19:22 +00:00
github-actions[bot]
4e3e1a39eb
Release crates v0.16.0 ( #3930 )
...
## [0.16.0] - 2024-06-26
- 6796891 ast: [**BREAKING**] Rename all instances of `BigintLiteral` to
`BigIntLiteral`. (#3898 ) (rzvxa)
- 1f85f1a ast: [**BREAKING**] Revert adding `span` field to the
`BindingPattern` type. (#3899 ) (rzvxa)
- ae09a97 ast: [**BREAKING**] Remove `Modifiers` from ts nodes (#3846 )
(Boshen)
- 1af5ed3 ast: [**BREAKING**] Replace `Modifiers` with `declare` and
`const` on `EnumDeclaration` (#3845 ) (Boshen)
- 0673677 ast: [**BREAKING**] Replace `Modifiers` with `declare` on
`Function` (#3844 ) (Boshen)
- ee6ec4e ast: [**BREAKING**] Replace `Modifiers` with `declare` and
`abstract` on `Class` (#3841 ) (Boshen)
- 9b38119 ast: [**BREAKING**] Replace `Modifiers` with `declare` on
`VariableDeclaration` (#3839 ) (Boshen)
- cfcef24 ast: [**BREAKING**] Add `directives` field to `TSModuleBlock`
(#3830 ) (Boshen)
- 4456034 ast: [**BREAKING**] Add `IdentifierReference` to
`ExportSpecifier` (#3820 ) (Boshen)
### Features
- 497769c ast: Add some visitor functions (#3785 ) (Dunqing)
- 4b06dc7 ast: Add TSType::TSIntrinsicKeyword to is_keyword (#3775 )
(Dunqing)
- 5847e16 ast,parser: Add `intrinsic` keyword (#3767 ) (Boshen)
- 2e026e1 ast_codegen: Generate `ast_kind.rs`. (#3888 ) (rzvxa)
- 09f4d3c ast_codegen: Add `ImplGetSpanGenerator`. (#3852 ) (rzvxa)
- 3e78f98 cfg: Add depth first search with hash sets. (#3771 ) (rzvxa)
- 01da2f7 codegen: Print TSThisParameter for TSCallSignatureDeclaration
and TSMethodSignature (#3792 ) (Dunqing)
- 2821e0e codegen: Print readonly keyword for TSIndexSignature (#3791 )
(Dunqing)
- 97575d8 codegen: Print TSClassImplements and TSThisParameter (#3786 )
(Dunqing)
- 5e2baf3 isolated-declarations: Report error for expando functions
(#3872 ) (Dunqing)
- 2cdb34f isolated-declarations: Support for class function overloads
(#3811 ) (Dunqing)
- 231b8f0 isolated-declarations: Support for export default function
overloads (#3809 ) (Dunqing)
- a37138f isolated-declarations: Improve the inference template literal
(#3797 ) (Dunqing)
- b0d7355 isolated-declarations: Transform const expression correctly
(#3793 ) (Dunqing)
- b38c34d isolated-declarations: Support inferring
ParenthesizedExpression (#3769 ) (Dunqing)
- 4134de8 isolated-declarations: Add ts error code to the error message
(#3755 ) (Dunqing)
- 94202de isolated-declarations: Add `export {}` when needed (#3754 )
(Dunqing)
- e95d8e3 isolated-declarations: Shrink span for arrow function that
needs an explicit return type (#3752 ) (Dunqing)
- df9971d isolated-declarations: Improve inferring the return type from
function (#3750 ) (Dunqing)
- 4aea2b1 isolated-declarations: Improve inferring the type of accessor
(#3749 ) (Dunqing)
- 9ea30c4 isolated-declarations: Treat AssignmentPattern as optional
(#3748 ) (Dunqing)
- dd540c8 minifier: Add skeleton for ReplaceGlobalDefines ast pass
(#3803 ) (Boshen)
- f3c3970 minifier: Add skeleton for RemoveDeadCode ast pass (#3802 )
(Boshen)
- 4fb90eb oxc: Export isolated-declarations (#3765 ) (Boshen)
- d5f6aeb semantic: Check for illegal symbol modifiers (#3838 ) (Don
Isaac)
- 01572f0 sourcemap: Impl `std::fmt::Display` for `Error` (#3902 )
(DonIsaac)
- 5501d5c transformer/typescript: Transform `import {} from "mod"` to
import `"mod"` (#3866 ) (Dunqing)
- 2a16ce0 traverse: Disable syntax check and disable build module record
(#3794 ) (Boshen)- d3cd3ea Oxc transform binding (#3896 ) (underfin)
### Bug Fixes
- 063cfde ast: Correct JSON serialization of `TSModuleBlock` (#3858 )
(overlookmotel)
- 66f404c ast: Fix JSON serialization of `BindingPattern` (#3856 )
(overlookmotel)
- 2766594 codegen: Print type parameters for MethodDefinition (#3922 )
(Dunqing)
- 27f0531 isolated-declarations: Private constructor reaching
unreachable (#3921 ) (Dunqing)
- 59ce38b isolated-declarations: Inferring of UnrayExpression
incorrectly (#3920 ) (Dunqing)
- 58e54f4 isolated-declarations: Report an error for parameters if they
are ObjectPattern or ArrayPattern without an explicit type (#3810 )
(Dunqing)
- cb8a272 isolated-declarations: Cannot infer nested `as const` (#3807 )
(Dunqing)
- d8ecce5 isolated-declarations: Infer BigInt number as `bigint` type
(#3806 ) (Dunqing)
- 4e241fc isolated-declarations: Missing `const` after transformed const
enum (#3805 ) (Dunqing)
- 683c7b0 isolated-declarations: Shouldn’t add declare in declaration
with export default (#3804 ) (Dunqing)
- 7d47fc3 isolated-declarations: Should stripe async and generator
keyword after transformed (#3790 ) (Dunqing)
- 8ce794d isolated-declarations: Inferring an incorrect return type when
there is an arrow function inside a function (#3768 ) (Dunqing)
- d29316a isolated-declarations: Transform incorrectly when there are
multiple functions with the same name (#3753 ) (Dunqing)
- bf1c250 isolated-declarations: False positives for non-exported
binding elements (#3751 ) (Dunqing)
- 275349a parser: Parse function type parameter name `accessor` (#3926 )
(Boshen)
- ef82c78 parser: Trailing comma is not allowed in
ParenthesizedExpression (#3885 ) (Dunqing)
- 13754cb parser: Change diagnostic to "modifier cannot be used here"
(#3853 ) (Boshen)
- 8c9fc63 semantic: Apply strict mode scope flag for strict mode TS
Modules (#3861 ) (overlookmotel)
- 99a40ce semantic: `export default foo` should have
`ExportLocalName::Default(NameSpan)` entry (#3823 ) (Boshen)
- 08fcfb3 transformer: Fix spans and scopes in TS enum transform (#3911 )
(overlookmotel)
- 17ad8f7 transformer: Create new scopes for new blocks in TS transform
(#3908 ) (overlookmotel)
- d76f34b transformer: TODO comments for missing scopes (#3837 )
(overlookmotel)
- e470731 transformer: TS transform handle when type exports first
(#3833 ) (overlookmotel)
- d774e54 transformer: TS transform generate do not copy statements
(#3832 ) (overlookmotel)
- ff1da27 transformer: Correct comment in example (#3831 )
(overlookmotel)
- 6dcc3f4 transformer: Fix TS annotation transform scopes (#3816 )
(overlookmotel)
- aea3e9a transformer: Correct spans for TS annotations transform
(#3782 ) (overlookmotel)
### Performance
- 92c21b2 diagnostics: Optimize string-buffer reallocations (#3897 )
(Luca Bruno)
- 4bf405d parser: Add a few more inline hints to cursor functions
(#3894 ) (Boshen)
- 10d1de5 semantic: Remove uneccessary allocation in builder (#3867 )
(DonIsaac)- 4f7ff7e Do not pass `&Atom` to functions (#3818 )
(overlookmotel)
### Refactor
- 6f26087 ast: Add comment about alternatives to `AstBuilder::copy`
(#3905 ) (overlookmotel)
- 442aca3 ast: Add comment not to use `AstBuilder::copy` (#3891 )
(overlookmotel)
- acf69fa ast: Refactor custom `Serialize` impls (#3859 ) (overlookmotel)
- 9e148e9 ast: Add line breaks (#3860 ) (overlookmotel)
- 363d3d5 ast: Add span field to the `BindingPattern` type. (#3855 )
(rzvxa)
- a648748 ast: Shorten code in AST builder (#3835 ) (overlookmotel)
- 1206967 ast: Reduce allocations in AST builder (#3834 ) (overlookmotel)
- 2f5d50e isolated-declarations: Remove `Modifiers` (#3847 ) (Boshen)
- 8027b1e minifier: Change prepass to ast_passes::remove_parens (#3801 )
(Boshen)
- a471e62 parser: Clean up `try_parse` (#3925 ) (Boshen)
- 3db2553 parser: Improve parsing of TypeScript type arguments (#3923 )
(Boshen)
- 4cf3c76 parser: Improve parsing of TypeScript types (#3903 ) (Boshen)
- 187f078 parser: Improve parsing of
`parse_function_or_constructor_type` (#3892 ) (Boshen)
- 97d59fc parser: Move code around for parsing `Modifiers` (#3849 )
(Boshen)
- 5ef28b7 transformer: Shorten code (#3912 ) (overlookmotel)
- d9f268d transformer: Shorten TS transform code (#3836 ) (overlookmotel)
- 21b0d01 transformer: Pass ref to function (#3781 ) (overlookmotel)
- 7c44703 transformer: Remove needless `pub` on TS enum transform
methods (#3774 ) (overlookmotel)
- 22c56d7 transformer: Move TSImportEqualsDeclaration transform code
(#3764 ) (overlookmotel)
- cd56aa9 transformer: Simplify TS export assignment transform (#3762 )
(overlookmotel)
- 512740d transformer: Move and simplify TS enum transform entry point
(#3760 ) (overlookmotel)
- 1061baa traverse: Separate `#[scope]` attr (#3901 ) (overlookmotel)
- fcd21a6 traverse: Indicate scope entry point with
`scope(enter_before)` attr (#3882 ) (overlookmotel)
- 24979c9 traverse: Use camel case props internally (#3880 )
(overlookmotel)
- 2045c92 traverse: Improve parsing attrs in traverse codegen (#3879 )
(overlookmotel)- d6437fe Clean up some usages of `with_labels` (#3854 )
(Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-27 20:38:31 +08:00
overlookmotel
5ef28b7375
refactor(transformer): shorten code ( #3912 )
...
Abbreviate `self.ctx.ast` to just `ast` to shorten code.
2024-06-26 05:16:07 +00:00
overlookmotel
08fcfb3c2f
fix(transformer): fix spans and scopes in TS enum transform ( #3911 )
...
Fix scope and spans in TS `enum` transform.
Incomplete - not yet fixed either scopes or spans for the interior of the function which TS `enum` is transformed into, only what's outside the function.
2024-06-26 05:16:05 +00:00
overlookmotel
17ad8f7d93
fix(transformer): create new scopes for new blocks in TS transform ( #3908 )
...
Create scopes for new `BlockStatement`s inserted in TS transform, and update scope tree.
2024-06-26 05:16:02 +00:00
rzvxa
1f85f1a5f7
refactor(ast)!: revert adding span field to the BindingPattern type. ( #3899 )
...
Since this is a temporary solution in the time that we are waiting for the `#[span]` hint, And there are already other workarounds used in our `ast_codegen` I propose removing it right away - sorry in my opinion adding it in the first place was a mistake - in favor of adding an edge case in the codegen. It is better to do the refactoring in the codegen instead of the production code which people may depend on.
2024-06-25 09:43:48 +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
rzvxa
363d3d57d7
refactor(ast): add span field to the BindingPattern type. ( #3855 )
...
So we don't have to introduce a special case while generating `GetSpan` implementations for all of our Ast types.
2024-06-23 16:00:40 +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
overlookmotel
d76f34b130
fix(transformer): TODO comments for missing scopes ( #3837 )
...
Where we create new block statements, need to generate scopes for them. Just adding TODO comments for this at present - we need an API to make this easy.
2024-06-23 08:45:28 +00:00
overlookmotel
d9f268dd55
refactor(transformer): shorten TS transform code ( #3836 )
...
Shorten code in TS transform. Remove a pointless reallocation of a `Box` in `transform_simple_assignment_target`.
2024-06-23 08:45:27 +00:00
overlookmotel
e4707315c0
fix(transformer): TS transform handle when type exports first ( #3833 )
...
Fix 2 bugs in TS transform:
1. Handle where export declaration precedes its import/definition. e.g. `export { X }; import { type X } from "x";`
2. Don't insert `export {}` statement if any other `export` statements remain.
Also refactor to simplify logic for removing imports/exports.
2024-06-23 08:45:25 +00:00
overlookmotel
d774e54f8e
fix(transformer): TS transform generate do not copy statements ( #3832 )
...
Remove an unsound usage of `ast.copy` from TS transform. Previously the same statements were inserted into the AST multiple times. Instead generate these statements on demand.
Also use a `std::vec::Vec` for temporary values, rather than allocating them into arena, where they take up space to no purpose.
2024-06-23 08:45:24 +00:00
overlookmotel
ff1da27278
fix(transformer): correct comment in example ( #3831 )
...
Correct instructions for transformer example.
2024-06-22 19:08:01 +00:00
Boshen
cfcef241db
feat(ast)!: add directives field to TSModuleBlock ( #3830 )
...
closes #3564
2024-06-22 18:14:08 +00:00
Boshen
445603444f
feat(ast)!: add IdentifierReference to ExportSpecifier ( #3820 )
...
closes #3795
closes #3796
2024-06-22 11:43:41 +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
overlookmotel
aaa944d66b
improve(transformer): avoid reallocating strings ( #3817 )
...
Re-use existing `Atom`s rather than allocating duplicate strings in TS transforms.
2024-06-22 04:47:58 +00:00
overlookmotel
6dcc3f4002
fix(transformer): fix TS annotation transform scopes ( #3816 )
...
Create symbol references for `IdentifierReferences` created in TS annotations transform.
2024-06-22 04:47:57 +00:00
overlookmotel
aea3e9a3f5
fix(transformer): correct spans for TS annotations transform ( #3782 )
...
Correct spans in output for TS annotations transform.
2024-06-20 01:33:12 +00:00
overlookmotel
21b0d0196b
refactor(transformer): pass ref to function ( #3781 )
...
Tiny refactor. Pass `&TSEnumDeclaration` to function instead of `&Box<TSEnumDeclaration>` (which is a reference to a reference).
2024-06-20 01:33:09 +00:00
overlookmotel
7c44703a4c
refactor(transformer): remove needless pub on TS enum transform methods ( #3774 )
...
Tiny refactor. Remove `pub` visibility on methods not used outside of module.
2024-06-19 15:51:04 +00:00
overlookmotel
22c56d73c3
refactor(transformer): move TSImportEqualsDeclaration transform code ( #3764 )
...
Pure refactor. Move all code related to `TSImportEqualsDeclaration` transform into `module.rs`.
2024-06-19 12:48:44 +00:00
overlookmotel
cd56aa9dd8
refactor(transformer): simplify TS export assignment transform ( #3762 )
...
Remove unnecessary jump through a `ModuleDeclaration` visitor, and visit as `TSExportAssignment` directly.
2024-06-19 12:31:02 +00:00