Boshen
213364a400
feat(minifier): minimize if (x) if (y) z -> if (x && y) z ( #8136 )
2024-12-27 02:44:47 +00:00
Yuichiro Yamashita
093ddd6f4d
chore(ast): use assert_eq! instead of assert! (crates/oxc_ast/src/lib.rs) ( #8125 )
...
related to https://github.com/oxc-project/oxc/pull/8124
2024-12-26 13:52:55 +00:00
Boshen
fef0b25fd3
feat(minifier): collapse var into for loop initializer ( #8119 )
...
`var a = 0; for(;a<0;a++) {}` => `for(var a = 0;a<0;a++) {}`
2024-12-26 05:22:02 +00:00
oxc-bot
5a1311e76c
release(crates): v0.44.0 ( #8110 )
...
## [0.44.0] - 2024-12-25
- ad2a620 ast: [**BREAKING**] Add missing
`AssignmentTargetProperty::computed` (#8097 ) (Boshen)
### Features
- c2daa20 ast: Add `Expression::into_inner_expression` (#8048 )
(overlookmotel)
- 618b6aa codege: Minify whitespace in object getter / setter (#8080 )
(Boshen)
- 4727667 codegen: Minify arrow expr `(x) => y` -> `x => y` (#8078 )
(Boshen)
- 0562830 codegen: Minify string with backtick when needed (#8095 )
(Boshen)
- 6237c05 codegen: Minify more whitespace (#8089 ) (Boshen)
- 6355b7c codegen: Minify `export { 's' as 's' }` -> `export { 's' }`
(#8093 ) (Boshen)
- fccfda9 codegen: Minify `class{static[computed]}` (#8088 ) (Boshen)
- f873139 codegen: Minify `for (_ of [])` -> `for(_ of[])` (#8086 )
(Boshen)
- 8b8cbcd codegen: Minify `case "foo"` -> `case"foo"` (#8085 ) (Boshen)
- 414c118 codegen: Minify `yield "s"` -> `yield"s"` (#8084 ) (Boshen)
- f8f067b codegen: Minify class method `async*fn(){}` (#8083 ) (Boshen)
- 1d5ae81 codegen: Minify `const [foo] = bar` -> `const[foo]=bar`
(#8079 ) (Boshen)
- e3f78fb codegen: `new Foo()` -> `new Foo` when minify (#8077 ) (Boshen)
- d84d60a codegen: Minify numbers with large exponents (#8074 ) (Boshen)
- 373279b codegen: Balance string quotes when minify whitespace (#8072 )
(Boshen)
- 5397fe9 minifier: Constant fold `undefined?.bar` -> `undefined`
(#8075 ) (Boshen)
- 1932f1e minifier: Fold `foo === undefined || foo === null` (#8063 ) (翠
/ green)
- 11c4bd8 span: Implement source type `{file basename}.d.{extension}.ts`
(#8109 ) (Boshen)
- be4feb4 syntax: Add `SymbolId::new` method (#8041 ) (overlookmotel)
- e632a7b transformer: Remove typescript symbols after transform (#8069 )
(Boshen)
### Bug Fixes
- bdc241d codegen: Disallow template literals in object property key
(#8108 ) (Boshen)
- 728ed20 codegen: Print `yield * ident` correctly (Boshen)
- b605baa minifier: Constant fold strings with tab char (#8096 ) (Boshen)
- de82492 parser: Report syntax errors for missing constructor
implementations (#8081 ) (camc314)
- 55d6eb9 parser: Disallow type parameters on class constructors (#8071 )
(injuly)
- be2c60d parser: Parse `import source from from 'mod'` (#8056 ) (Boshen)
- 708e9cf semantic: Report errors for missing class method impls (#8082 )
(camc314)
- 3057686 transformer/class-properties: Unwrap parenthesised expressions
(#8049 ) (overlookmotel)
- e67cd05 transformer/class-properties: Correctly resolve private fields
pointing to private accessors (#8047 ) (overlookmotel)
- 6b08c6e transformer/class-properties: Correctly resolve private fields
pointing to private methods (#8042 ) (overlookmotel)
- 274f117 transformer/nullish-coalescing: Use correct scope id for
binding (#8053 ) (camc314)
### Performance
- 78d2e83 sourcemap: Improve perf of `search_original_line_and_column`
(#7926 ) (Cameron)
### Refactor
- 7110c7b codegen: Add `print_quoted_utf16` and `print_unquoted_utf16`
methods (#8107 ) (Boshen)
- 8b54d89 minifier: Remove parens must happen on enter (#8060 ) (Boshen)
- 7cb84f3 minifier: Only minify on ast node exit (#8059 ) (Boshen)
- 77d845a minifier: Fuse DCE AST passes (#8058 ) (Boshen)
- 6123f5e minifier: Fold statements on exit (#8057 ) (Boshen)
- cbd5169 transformer/class-properties: Do not recreate private field if
not transforming it (#8044 ) (overlookmotel)
- 98e8a72 transformer/class-properties: Do not take mut ref when immut
ref will do (#8040 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-25 21:03:09 +08:00
Boshen
ad2a620d61
fix(ast)!: add missing AssignmentTargetProperty::computed ( #8097 )
2024-12-24 13:27:00 +00:00
overlookmotel
c2daa20751
feat(ast): add Expression::into_inner_expression ( #8048 )
...
Add `Expression::into_inner_expression`. Does the same as `get_inner_expression` and `get_inner_expression_mut`, but operates on an owned `Expression`.
2024-12-23 03:44:12 +00:00
oxc-bot
d69de3629d
release(crates): v0.43.0 ( #8054 )
...
## [0.43.0] - 2024-12-21
- de4c772 traverse: [**BREAKING**] Rename `Ancestor::is_via_*` methods
to `is_parent_of_*` (#8031 ) (overlookmotel)
- ed75e42 semantic: [**BREAKING**] Make SymbolTable fields `pub(crate)`
instead of `pub` (#7999 ) (Boshen)
### Features
- 75b775c allocator: `Vec<u8>::into_string` (#8017 ) (overlookmotel)
- 8547e02 ast: Implement `allocator_api2` for `Allocator` (#8043 )
(Boshen)
- 63a95e4 ast: Add `AstBulder::move_property_key` (#7998 )
(overlookmotel)
- 897a1a8 transformer/class-properties: Exit faster from super
replacement visitor (#8028 ) (overlookmotel)
- 3ea4109 transformer/class-properties: Transform super update
expressions within static prop initializer (#7997 ) (Dunqing)
- cc57db3 transformer/class-properties: Transform super assignment
expressions within static prop initializer (#7991 ) (Dunqing)
- 6b6444b traverse: Record current block scope (#8007 ) (overlookmotel)
### Bug Fixes
- 043252d transformer/class-properties: Replace `this` and class name in
static blocks (#8035 ) (overlookmotel)
- 273795d transformer/class-properties: Run other transforms on static
properties, static blocks, and computed keys (#7982 ) (overlookmotel)
### Performance
- c0dd3f8 ast: `move_expression` and `move_statement` produce dummy with
no span (#7995 ) (overlookmotel)
- 862838f codegen: Remove useless to_owned (#8014 ) (Dunqing)
- 2736657 semantic: Allocate `UnresolvedReferences` in allocator (#8046 )
(Boshen)
- 2e8872c semantic: Allocate child scope in allocator (#8045 ) (Boshen)
- 414e828 semantic: Allocate symbol data in Allocator (#8012 ) (Boshen)
- 7aebed0 semantic: Allocate `Bindings` in allocator (#8021 ) (Boshen)
- 0f9308f transformer/react-refresh: Reduce allocations (#8018 )
(overlookmotel)
- 0deb9e6 transformer/react-refresh: Reserve capacity in hook key string
(#8016 ) (overlookmotel)
- 7b70347 transformer/react-refresh: Avoid allocating string in each
hook call (#8013 ) (Dunqing)
### Documentation
- df5c341 ast: Improve docs for `AstBuilder::move_*` methods (#7994 )
(overlookmotel)
### Refactor
- f1adf9f semantic: `ScopeTree::rename_binding` remove old binding first
(#8020 ) (overlookmotel)
- 02f968d semantic: Change `Bindings` to a plain `FxHashMap` (#8019 )
(Boshen)
- e7476a1 semantic: Remove `serialize` (#8015 ) (Boshen)
- 1cf7b83 semantic: Simplify handling namespace stack (#7987 ) (Dunqing)
- 48cb52b semantic: Remove resetting `current_reference_flags` in visit
functions (#7986 ) (Dunqing)
- 3250a47 semantic: Remove unused current_symbol_flags (#7985 ) (Dunqing)
- efe96ec semantic: Use `Stack` for function stack node ids (#7984 )
(Dunqing)
- ac097e9 transformer/class-properties: Rename file (#8036 )
(overlookmotel)
- 059a5dd transformer/class-properties: Do not pass `ScopeId` into
`insert_instance_inits` (#8001 ) (overlookmotel)
- 0a38eea transformer/class-properties: Use `temp_var_name_base` to
generate temp var names for `super` transform (#8004 ) (overlookmotel)
- d1b7181 transformer/class-properties: Rename var (#8006 )
(overlookmotel)
- 5a23d72 transformer/class-properties: Remove outdated comment (#8000 )
(overlookmotel)
- b3a5f3e transformer/class-properties: Mark
`transform_assignment_expression_if_super_member_assignment_target` as
inline (#7993 ) (Dunqing)
### Testing
- bcb33c0 semantic: Add a test for catch parameters reference (#7988 )
(Dunqing)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-21 15:07:21 +08:00
overlookmotel
c0dd3f8e32
perf(ast): move_expression and move_statement produce dummy with no span ( #7995 )
...
The purpose of `AstBuilder::move_*` methods is to create dummy nodes which will later be replaced again. Give the dummy nodes empty spans as it's faster, and no point in them having a real span.
2024-12-20 03:10:23 +00:00
overlookmotel
63a95e4aa2
feat(ast): add AstBulder::move_property_key ( #7998 )
...
Add `AstBuilder::move_property_key` method, same as the rest of `move_*` methods.
2024-12-18 23:17:54 +00:00
overlookmotel
df5c341c38
docs(ast): improve docs for AstBuilder::move_* methods ( #7994 )
2024-12-18 15:07:25 +00:00
oxc-bot
3631eed975
release(crates): v0.42.0 ( #7983 )
...
## [0.42.0] - 2024-12-18
- 84b75a0 semantic: [**BREAKING**] Remove `ScopeFlags::Modifiers`
(#7935 ) (overlookmotel)
- c071494 semantic: [**BREAKING**] Remove `SymbolTable::rename` method
(#7868 ) (overlookmotel)
### Features
- 8b7c5ae ast: Add `AstBuilder::atom_from_cow` (#7974 ) (overlookmotel)
- 46e2e27 data_structures: Implement `Default` for `NonEmptyStack`
(#7946 ) (overlookmotel)
- db9e93b mangler: Mangle top level variables (#7907 ) (翠 / green)
- 075bd16 minifier: Fold bitwise operation (#7908 ) (翠 / green)
- c16a851 napi/transform: Add `jsx: 'preserve'` option (#7965 ) (Boshen)
- 81eedb1 parser: 'readonly' type modifier is only permitted on array
and tuple literal types. (#7880 ) (Boshen)
- b9322c6 semantic: Re-export all flags and ID types (#7886 )
(overlookmotel)
- c30a982 span: Add `impl From<ArenaString> for Atom` (#7973 )
(overlookmotel)
- 02b653c transformer/class-properties: Do not create temp var for
template literal computed key (#7919 ) (overlookmotel)
- feac02e transformer/class-properties: Only rename symbols if necessary
(#7896 ) (overlookmotel)
- 6bc530d transformer/class-properties: Transform super call expression
that is inside static prop initializer (#7831 ) (Dunqing)
- 53e2bc0 traverse: Add `TraverseScoping::rename_symbol` method (#7871 )
(overlookmotel)
### Bug Fixes
- 3659e6d cfg: Include export default code in CFG instructions (#7862 )
(Jan Olaf Martin)
- 850dd43 codegen: Missing `,` when generating type parameters with jsx
(#7929 ) (Dunqing)
- 4799471 minfier: Bigint bitwise operation only works with bigint
(#7937 ) (Boshen)
- de8a86e minifier: Incorrect minification in `try_fold_left_child_op`
(#7949 ) (翠 / green)
- 9a30910 oxc_transformer: Inject_global_variables should considering
string imported name (#7768 ) (IWANABETHATGUY)
- 111dc52 parser: Include export token in spans of
TSNamespaceExportDeclaration (#7963 ) (branchseer)
- 14c51ff semantic: Remove inherting `ScopeFlags::Modifier` from parent
scope (#7932 ) (Dunqing)
- 596aead semantic: Reset references flags when resolved (#7923 )
(Dunqing)
- 4924073 semantic: `ScopeTree::rename_binding` preserve order of
bindings (#7870 ) (overlookmotel)
- bb38065 transformer/class-properties: Do not transform `super.prop` in
nested method within static prop initializer (#7978 ) (overlookmotel)
- e76fbb0 transformer/class-properties: Fix symbol clashes in instance
prop initializers (#7872 ) (overlookmotel)
- c0576fa transformer/class-properties: Use UID for `args` in created
class constructor (#7866 ) (overlookmotel)
- d660d8d transformer/optional-chaining: Do not create unused reference
when `noDocumentAll` assumption (#7847 ) (overlookmotel)
- 4920c6a transformer/optional-chaining: Avoid creating a useless
reference when `noDocumentAll` is true (#7832 ) (Dunqing)
### Performance
- a5f04a7 ast: Faster `Comment::is_jsdoc` (#7905 ) (overlookmotel)
- 4b24335 codegen: Improve printing of statement comments (#7857 )
(Boshen)
- 71a40a2 codegen: Guard comment printing comments when there are no
comments (#7856 ) (Boshen)
- b31f123 transformer/class-properties: Do not re-generate same method
key (#7915 ) (overlookmotel)
- 8ca8fce transformer/class-properties: Reduce work updating scopes when
transforming static prop initializers (#7904 ) (overlookmotel)
- 80d0b3e transformer/class-properties: Fast path for instance prop
initializer scope re-parenting (#7901 ) (overlookmotel)
- 38aafa2 transformer/class-properties: Reduce size of
`transform_call_expression_for_super_member_expr` (#7859 )
(overlookmotel)
### Documentation
- e49de81 ast: Document `Expression::is_*` methods (#7853 )
(overlookmotel)
- 10a86b9 transformer: Fix comments (#7925 ) (overlookmotel)
- f4cb5d3 transformer: Clarify comment (#7918 ) (overlookmotel)
- 41a1456 transformer/class-properties: Correct doc comments (#7966 )
(overlookmotel)
- 18441af transformer/class-properties: Remove oudated todo for
assignment expression (#7955 ) (Dunqing)
- 1317c00 transformer/class-properties: Clarify doc comments (#7914 )
(overlookmotel)
- 9989b58 transformer/class-properties: Re-order file list in doc
comment (#7911 ) (overlookmotel)
- 7390048 transformer/class-properties: Reformat doc comment (#7909 )
(overlookmotel)
### Refactor
- beb982a ast: Use exhaustive match for `Argument` to
`ArrayExpressionElement` conversion (#7848 ) (overlookmotel)
- 3858221 global: Sort imports (#7883 ) (overlookmotel)
- 1314c97 minifier: Expose dce as an API instead of an option (#7957 )
(Boshen)
- 6551dfe semantic: Pass `&str` instead of `Cow` (#7972 ) (overlookmotel)
- b8d2bd2 semantic: Move determining references flags for export
specifier to `visit_export_named_declaration` (#7924 ) (Dunqing)
- 98d7946 semantic: Import flags and ID types from `oxc_syntax` (#7887 )
(overlookmotel)
- 1cf8f8f semantic: `SymbolTable::set_name` return old name (#7869 )
(overlookmotel)
- 5d42df8 semantic: Use `Expression::is_super` (#7851 ) (overlookmotel)
- 8cf9766 semantic, syntax, wasm: Remove `#![allow(non_snake_case)]`
(#7863 ) (overlookmotel)
- d59bbae transformer: Remove unneeded lint `#[allow]` (#7971 )
(overlookmotel)
- 2c94236 transformer: Improve encapsulation of transforms (#7888 )
(overlookmotel)
- 34091b2 transformer: Use `Expression::is_super` (#7852 )
(overlookmotel)
- d4d7bc0 transformer/async-to-generator: Avoid allocating unnecessary
`Atom`s (#7975 ) (overlookmotel)
- 2e5ffd3 transformer/class-properties: Store `temp_var_is_created` on
`ClassBindings` (#7981 ) (overlookmotel)
- 27cc6da transformer/class-properties: Store `is_declaration` only on
`ClassDetails` (#7980 ) (overlookmotel)
- ee282f8 transformer/class-properties: Remove `move_expression`s
(#7979 ) (overlookmotel)
- 94b376a transformer/class-properties: Simplify logic for when to
create temp binding (#7977 ) (overlookmotel)
- ff9d1b3 transformer/class-properties: Comments about shorter output
(#7976 ) (overlookmotel)
- 6fc40f0 transformer/class-properties: Pass `BoundIdentifier`s by
reference (#7968 ) (overlookmotel)
- 69eeeea transformer/class-properties: Methods take `&self` where
possible (#7967 ) (overlookmotel)
- 98340bb transformer/class-properties: Use stack of `ClassDetails`
(#7947 ) (overlookmotel)
- 088dd48 transformer/class-properties: Shorten code (#7913 )
(overlookmotel)
- 544ffbf transformer/class-properties: Split up code into multiple
files (#7912 ) (overlookmotel)
- dcaf674 transformer/class-properties: Rename file (#7910 )
(overlookmotel)
- 6243980 transformer/class-properties: Instance prop inits visitor use
`Visit` (#7867 ) (overlookmotel)
- eb47d43 transformer/class-properties: Re-use existing `Vec` (#7854 )
(overlookmotel)
- 1380b7b transformer/class-properties: Reduce visibility of method
(#7858 ) (overlookmotel)
- 0f5e078 transformer/class-properties: Rename `*_owner` to `owned_*`
(#7855 ) (Dunqing)
- 4ea90d4 transformer/react-refresh: Calculate signature key once
(#7970 ) (Dunqing)
- 15b9bff transformer/typescript: Reuse `Atom` (#7969 ) (overlookmotel)
### Styling
- fb897f6 data_structures: Add line break (#7882 ) (overlookmotel)
- 7fb9d47 rust: `cargo +nightly fmt` (#7877 ) (Boshen)
### Testing
- 523d48c transformer: Move named test to exports folder (#7922 )
(Dunqing)
- e766051 transformer: Skip test which uses filesystem under miri
(#7874 ) (overlookmotel)
- f39e65e transformer: Prevent lint error when running miri (#7873 )
(overlookmotel)
Co-authored-by: Dunqing <29533304+Dunqing@users.noreply.github.com>
2024-12-18 11:48:12 +08:00
overlookmotel
8b7c5ae09c
feat(ast): add AstBuilder::atom_from_cow ( #7974 )
...
Various methods e.g. `PropertyKey::static_name` return a `Cow<'a, str>`.
When we need to create an `Atom` from such a `Cow`, we can avoid reallocating the string into arena again if the `Cow` already borrows an arena string. The `Atom` can reference that same string, rather than making another copy of it in arena.
Add `AstBuilder::atom_from_cow` method for this purpose.
2024-12-18 02:25:35 +00:00
overlookmotel
c30a982da3
feat(span): add impl From<ArenaString> for Atom ( #7973 )
...
Add conversion method from `oxc_allocator::String` to `Atom`. This is a zero-cost conversion, because the string is already in the arena.
2024-12-18 02:25:34 +00:00
overlookmotel
a5f04a72b5
perf(ast): faster Comment::is_jsdoc ( #7905 )
...
Small optimization.
Replace string slice + `starts_with` (at least 3 x bounds checks + 2 x UTF8 character boundary checks) with a single byte read (1 x bounds check).
2024-12-15 04:28:27 +00:00
overlookmotel
3858221f45
refactor(global): sort imports ( #7883 )
...
Pure refactor. Re-order imports for clarity:
1. `std`
2. External crates
3. `oxc_*` crates
4. Current crate `use crate::...`
5. Super `use super::...`
6. Local modules
This order is from "furthest away" to "closest". This makes it clearer to see what is coming from where.
`cargo +nightly fmt` (#7877 ) did a lot of the work, but unfortunately `rustfmt` does not have an option to (a) put workspace crates in a separate block from external crates and (b) move `mod` statements to after `use` statements.
2024-12-14 15:07:21 +00:00
Boshen
7fb9d47460
style(rust): cargo +nightly fmt ( #7877 )
2024-12-14 06:03:31 +00:00
Jan Olaf Martin
3659e6d768
fix(cfg): include export default code in CFG instructions ( #7862 )
...
Previously any instructions happening inside of the expression passed to
`export default` were invisible in the CFG.
Example:
```
// Uncommenting this line makes the call to bar() disappear from the
// CFG view of the program:
// export default
bar();
```
2024-12-14 12:09:28 +08:00
overlookmotel
beb982a69e
refactor(ast): use exhaustive match for Argument to ArrayExpressionElement conversion ( #7848 )
...
Follow-on after #7830 . Refactor.
Use an exhaustive match in implementation of `From<Argument<'a>> for ArrayExpressionElement<'a>`.
At present this change makes no difference. But the reason I feel an exhaustive match is preferable here is that if we add a variant to `Argument` enum later, then this match will be missing an arm to handle that variant, and compiler will refuse to compile until we deal with it.
Whereas before this PR, compiler would not complain, but instead it'd be a runtime panic when `into_expression` discovers that the new `Argument` variant is not an `Expression`.
2024-12-13 14:52:12 +00:00
overlookmotel
e49de81544
docs(ast): document Expression::is_* methods ( #7853 )
2024-12-13 14:12:45 +00:00
Dunqing
6bc530d2e2
feat(transformer/class-properties): transform super call expression that is inside static prop initializer ( #7831 )
2024-12-13 13:47:38 +00:00
oxc-bot
1428527da6
release(crates): v0.41.0 ( #7846 )
...
## [0.41.0] - 2024-12-13
- fb325dc ast: [**BREAKING**] `span` field must be the first element
(#7821 ) (Boshen)
- 96a26d3 ast: [**BREAKING**] Rename `is_strict` methods to
`has_use_strict_directive` (#7783 ) (overlookmotel)
### Features
- 8991f33 ast: Add `visit_span` to `Visit` and `VisitMut` (#7816 )
(overlookmotel)
- f7900ab ast: Add `ArrowFunctionExpression::has_use_strict_directive`
method (#7784 ) (overlookmotel)
- e727ae9 transformer/class-properties: Transform super member
expressions that are inside static prop initializer (#7815 ) (Dunqing)
### Bug Fixes
- 7610dc1 parser: Parse `import source from 'mod'` (#7833 ) (Boshen)
- 9479e2b semantic: Missing references when `export {}` references a
type-only binding and a normal (#7812 ) (Yunfei He)
- 7a83230 semantic: Missing reference when `export default` references a
type alias binding (#7813 ) (Dunqing)
- 4a3bca8 semantic: Fix identifying strict mode arrow functions (#7785 )
(overlookmotel)
- 5b7e1ad transformer: Remove span of define value (#7811 ) (Hiroshi
Ogawa)
- 14896cb transformer/class-properties: Create temp vars in correct
scope (#7824 ) (overlookmotel)
- 25bb6da transformer/class-properties: Fix `ScopeId`s in instance prop
initializers (#7823 ) (overlookmotel)
- 65b109a transformer/class-properties: No `raw` for generated
`StringLiteral` (#7825 ) (overlookmotel)
- 2964a61 transformer/class-properties: Unwrap failed when private field
expression doesn't contain optional expression in `ChainExpression`
(#7798 ) (Dunqing)
- 6fa6785 transformer/class-properties: Panic when the callee or member
is `ParenthesisExpression` or TS-syntax expressions. (#7795 ) (Dunqing)
- bb22c67 transformer/class-properties: Fix `ScopeId`s in static prop
initializers (#7791 ) (overlookmotel)
- caa57f1 transformer/class-properties: Fix scope flags in static prop
initializers (#7786 ) (overlookmotel)
### Performance
- 4448b63 codegen: Faster writing indentation (#7820 ) (overlookmotel)
- afaaffa codegen: Fast path for `options.print_comments()` (#7806 )
(Boshen)
### Refactor
- 0f367e5 semantic: Improve the logic of resolving references to be
cleaner (#7829 ) (Dunqing)
- 5710950 semantic: Move export-related reference flags logic to visit
functions (#7828 ) (Dunqing)
- b290ebd transformer: Handle `<CWD>` in test runner (#7799 ) (Dunqing)
- e70deb9 transformer/class-properties: Locate instance props insertion
location in separate step (#7819 ) (overlookmotel)
- afc5f1e transformer/class-properties: De-deduplicate code (#7805 )
(overlookmotel)
- 47a91d2 transformer/class-properties: Shorten code (#7804 )
(overlookmotel)
- 54ef2b9 transformer/class-properties: Rename
`debug_assert_expr_is_not_parenthesis_or_typescript_syntax` (#7803 )
(overlookmotel)
- 3cdc47c transformer/class-properties: `#[inline(always)]` on
`assert_expr_neither_parenthesis_nor_typescript_syntax` (#7802 )
(overlookmotel)
### Testing
- d72c888 transformer/replace-global-defines: Remove panicking test
(#7838 ) (overlookmotel)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-13 21:25:13 +08:00
Dunqing
6466a4a990
feat(ast): implement From<Argument> for ArrayExpressionElement ( #7830 )
2024-12-13 13:14:28 +00:00
Boshen
fb325dce99
refactor(ast)!: span field must be the first element ( #7821 )
...
For consistency. And maybe a small performance improvement when enum
bytes are aligned.
2024-12-12 16:50:01 +00:00
overlookmotel
8991f33fc7
feat(ast): add visit_span to Visit and VisitMut ( #7816 )
...
Add `Visit::visit_span` and `VisitMut::visit_span` methods, to facilitate #7811 .
Both are no-ops by default, and marked `#[inline]`, so this produces no performance impact.
2024-12-12 13:33:12 +00:00
overlookmotel
f7900ab246
feat(ast): add ArrowFunctionExpression::has_use_strict_directive method ( #7784 )
...
Add `ArrowFunctionExpression::has_use_strict_directive` method to go with `Function::has_use_strict_directive` etc.
2024-12-10 23:57:41 +00:00
overlookmotel
96a26d3b29
refactor(ast)!: rename is_strict methods to has_use_strict_directive ( #7783 )
...
The name `is_strict` was misleading for these methods, because it doesn't tell you if the e.g. function *is* strict mode, only whether it contains a `"use strict"` directive. `Function::is_strict` might return `false` for a function which does have strict mode semantics because it's e.g. in an ESM file.
Rename these methods to `has_use_strict_directive` to better reflect what they do.
For `Program`, change the method to only check for `"use strict"` directive and not to look at `source_type`. `Semantic` should be the source of truth on strict/sloppy mode of AST nodes. It's cheaper to look up the `ScopeFlags` than to iterate over `directives`, so don't encourage this anti-pattern by providing a "rival" method.
2024-12-10 23:57:40 +00:00
oxc-bot
bd572c609b
release(crates): v0.40.1 ( #7781 )
...
## [0.40.1] - 2024-12-10
### Bug Fixes
- 18d0ce3 napi: Rename `Error` to `OxcError` to avoid name collision
(#7780 ) (Boshen)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-12-11 00:35:34 +08:00
oxc-bot
6768f7ded2
release(crates): v0.40.0 ( #7775 )
2024-12-10 23:04:43 +08:00
overlookmotel
7dcf6b4d7c
feat(ast, transformer): add AstBuilder::use_strict_directive method ( #7770 )
...
Add `AstBuilder::use_strict_directive` method, and use it in transformer.
2024-12-10 13:17:27 +00:00
overlookmotel
98afe6543f
refactor(ast): AstBuilder extra methods use SPAN ( #7769 )
...
Pure refactor. `SPAN` is shorter than `Span::default()` and is what we use elsewhere.
2024-12-10 13:11:19 +00:00
Boshen
72eab6cd96
feat(parser)!: stage 3 import source and import defer ( #7706 )
...
* https://github.com/tc39/proposal-defer-import-eval
* https://github.com/tc39/proposal-source-phase-imports
* https://tc39.es/proposal-source-phase-imports/#sec-ecmascript-language-expressions
* https://tc39.es/proposal-defer-import-eval/#prod-NameSpaceImport
2024-12-06 16:15:52 +00:00
overlookmotel
2179b93729
fix(estree): make type of BigIntLiteral::raw prop in ESTree AST optional ( #7663 )
...
`BigIntLiteral`'s `raw` field is not an `Option` on Rust side, but this is an internal implementation detail - we may parse bigints to a `BigInt` in future (as we did in the past before we hit a memory leak problem), and make `raw` an `Option`.
So at present, the `raw` field is always non-null in JS-side AST. But update the TS type def to reflect that it should be an optional property. This aligns with ESTree.
2024-12-05 04:00:57 +00:00
overlookmotel
cbba26c237
fix(estree): raw: null in ESTree AST for generated NullLiterals ( #7662 )
...
In JS-side AST, leave `raw` field as `null` for `NullLiteral`s, if they are generated and have no raw representation in source text.
2024-12-05 04:00:56 +00:00
overlookmotel
1d59fc8353
fix(estree): raw: null in ESTree AST for generated BooleanLiterals ( #7661 )
...
In JS-side AST, leave `raw` field as `null` for `BooleanLiteral`s, if they are generated and have no raw representation in source text.
2024-12-05 04:00:55 +00:00
overlookmotel
8993e893a0
refactor(ast): shorten code ( #7659 )
...
Pure refactor. Shorten code - `Vec` instead of `std::vec::Vec`.
2024-12-05 01:16:16 +00:00
overlookmotel
746c8aaa4f
refactor(ast): rename vars ( #7658 )
...
Pure refactor. Rename vars in serialization code. `value.value` is a bit confusing.
2024-12-05 01:16:15 +00:00
overlookmotel
0c9cc48806
style(ast): import Atom ( #7657 )
...
Code style refactor. Import `Atom` at top of file to shorten code.
2024-12-05 00:53:38 +00:00
Song Gao
ebc80f6749
refactor(ast)!: change 'raw' from &str to Option<Atom> ( #7547 )
...
Fix #7254
Changed all "raw" properties of literal types (if they have this property) to `Option<Atom>`.
---------
Co-authored-by: overlookmotel <theoverlookmotel@gmail.com>
2024-12-05 00:34:45 +00:00
tbashiyy
bd9d38a9a0
feat(linter): Implement eslint:yoda ( #7559 )
...
In this PR, implement
[eslint:yoda](https://eslint.org/docs/latest/rules/yoda )
ref: https://github.com/oxc-project/oxc/issues/479
2024-12-04 15:58:21 +00:00
oxc-bot
fee2143f4c
release(crates): v0.39.0 ( #7643 )
2024-12-04 19:43:22 +08:00
renovate
d0842e070a
chore(deps): update dependency rust to v1.83.0 ( #7537 )
...
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://redirect.github.com/rust-lang/rust ) | minor | `1.82.0` -> `1.83.0` |
---
### Release Notes
<details>
<summary>rust-lang/rust (rust)</summary>
### [`v1.83.0`](https://redirect.github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1830-2024-11-28 )
[Compare Source](https://redirect.github.com/rust-lang/rust/compare/1.82.0...1.83.0 )
\==========================
<a id="1.83.0-Language"></a>
## Language
- [Stabilize `&mut`, `*mut`, `&Cell`, and `*const Cell` in const.](https://redirect.github.com/rust-lang/rust/pull/129195 )
- [Allow creating references to statics in `const` initializers.](https://redirect.github.com/rust-lang/rust/pull/129759 )
- [Implement raw lifetimes and labels (`'r#ident`).](https://redirect.github.com/rust-lang/rust/pull/126452 )
- [Define behavior when atomic and non-atomic reads race.](https://redirect.github.com/rust-lang/rust/pull/128778 )
- [Non-exhaustive structs may now be empty.](https://redirect.github.com/rust-lang/rust/pull/128934 )
- [Disallow implicit coercions from places of type `!`](https://redirect.github.com/rust-lang/rust/pull/129392 )
- [`const extern` functions can now be defined for other calling conventions.](https://redirect.github.com/rust-lang/rust/pull/129753 )
- [Stabilize `expr_2021` macro fragment specifier in all editions.](https://redirect.github.com/rust-lang/rust/pull/129972 )
- [The `non_local_definitions` lint now fires on less code and warns by default.](https://redirect.github.com/rust-lang/rust/pull/127117 )
<a id="1.83.0-Compiler"></a>
## Compiler
- [Deprecate unsound `-Csoft-float` flag.](https://redirect.github.com/rust-lang/rust/pull/129897 )
- Add many new tier 3 targets:
- [`aarch64_unknown_nto_qnx700`](https://redirect.github.com/rust-lang/rust/pull/127897 )
- [`arm64e-apple-tvos`](https://redirect.github.com/rust-lang/rust/pull/130614 )
- [`armv7-rtems-eabihf`](https://redirect.github.com/rust-lang/rust/pull/127021 )
- [`loongarch64-unknown-linux-ohos`](https://redirect.github.com/rust-lang/rust/pull/130750 )
- [`riscv32-wrs-vxworks` and `riscv64-wrs-vxworks`](https://redirect.github.com/rust-lang/rust/pull/130549 )
- [`riscv32{e|em|emc}-unknown-none-elf`](https://redirect.github.com/rust-lang/rust/pull/130555 )
- [`x86_64-unknown-hurd-gnu`](https://redirect.github.com/rust-lang/rust/pull/128345 )
- [`x86_64-unknown-trusty`](https://redirect.github.com/rust-lang/rust/pull/130453 )
Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.
<a id="1.83.0-Libraries"></a>
## Libraries
- [Implement `PartialEq` for `ExitCode`.](https://redirect.github.com/rust-lang/rust/pull/127633 )
- [Document that `catch_unwind` can deal with foreign exceptions without UB, although the exact behavior is unspecified.](https://redirect.github.com/rust-lang/rust/pull/128321 )
- [Implement `Default` for `HashMap`/`HashSet` iterators that don't already have it.](https://redirect.github.com/rust-lang/rust/pull/128711 )
- [Bump Unicode to version 16.0.0.](https://redirect.github.com/rust-lang/rust/pull/130183 )
- [Change documentation of `ptr::add`/`sub` to not claim equivalence with `offset`.](https://redirect.github.com/rust-lang/rust/pull/130229 ).
<a id="1.83.0-Stabilized-APIs"></a>
## Stabilized APIs
- [`BufRead::skip_until`](https://doc.rust-lang.org/stable/std/io/trait.BufRead.html#method.skip_until )
- [`ControlFlow::break_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.break_value )
- [`ControlFlow::continue_value`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.continue_value )
- [`ControlFlow::map_break`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_break )
- [`ControlFlow::map_continue`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.map_continue )
- [`DebugList::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugList.html#method.finish_non_exhaustive )
- [`DebugMap::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugMap.html#method.finish_non_exhaustive )
- [`DebugSet::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugSet.html#method.finish_non_exhaustive )
- [`DebugTuple::finish_non_exhaustive`](https://doc.rust-lang.org/stable/core/fmt/struct.DebugTuple.html#method.finish_non_exhaustive )
- [`ErrorKind::ArgumentListTooLong`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ArgumentListTooLong )
- [`ErrorKind::Deadlock`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.Deadlock )
- [`ErrorKind::DirectoryNotEmpty`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.DirectoryNotEmpty )
- [`ErrorKind::ExecutableFileBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ExecutableFileBusy )
- [`ErrorKind::FileTooLarge`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.FileTooLarge )
- [`ErrorKind::HostUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.HostUnreachable )
- [`ErrorKind::IsADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.IsADirectory )
- [`ErrorKind::NetworkDown`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkDown )
- [`ErrorKind::NetworkUnreachable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NetworkUnreachable )
- [`ErrorKind::NotADirectory`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotADirectory )
- [`ErrorKind::NotSeekable`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.NotSeekable )
- [`ErrorKind::ReadOnlyFilesystem`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ReadOnlyFilesystem )
- [`ErrorKind::ResourceBusy`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.ResourceBusy )
- [`ErrorKind::StaleNetworkFileHandle`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StaleNetworkFileHandle )
- [`ErrorKind::StorageFull`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.StorageFull )
- [`ErrorKind::TooManyLinks`](https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#variant.TooManyLinks )
- [`Option::get_or_insert_default`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.get_or_insert_default )
- [`Waker::data`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.data )
- [`Waker::new`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.new )
- [`Waker::vtable`](https://doc.rust-lang.org/stable/core/task/struct.Waker.html#method.vtable )
- [`char::MIN`](https://doc.rust-lang.org/stable/core/primitive.char.html#associatedconstant.MIN )
- [`hash_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/enum.Entry.html#method.insert_entry )
- [`hash_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/hash_map/struct.VacantEntry.html#method.insert_entry )
These APIs are now stable in const contexts:
- [`Cell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.Cell.html#method.into_inner )
- [`Duration::as_secs_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f32 )
- [`Duration::as_secs_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.as_secs_f64 )
- [`Duration::div_duration_f32`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f32 )
- [`Duration::div_duration_f64`](https://doc.rust-lang.org/stable/core/time/struct.Duration.html#method.div_duration_f64 )
- [`MaybeUninit::as_mut_ptr`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.as_mut_ptr )
- [`NonNull::as_mut`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.as_mut )
- [`NonNull::copy_from`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from )
- [`NonNull::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_from_nonoverlapping )
- [`NonNull::copy_to`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to )
- [`NonNull::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.copy_to_nonoverlapping )
- [`NonNull::slice_from_raw_parts`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.slice_from_raw_parts )
- [`NonNull::write`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write )
- [`NonNull::write_bytes`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_bytes )
- [`NonNull::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.write_unaligned )
- [`OnceCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.OnceCell.html#method.into_inner )
- [`Option::as_mut`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut )
- [`Option::expect`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.expect )
- [`Option::replace`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.replace )
- [`Option::take`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.take )
- [`Option::unwrap`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap )
- [`Option::unwrap_unchecked`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.unwrap_unchecked )
- [`Option::<&_>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied )
- [`Option::<&mut _>::copied`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.copied-1 )
- [`Option::<Option<_>>::flatten`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.flatten )
- [`Option::<Result<_, _>>::transpose`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.transpose )
- [`RefCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.RefCell.html#method.into_inner )
- [`Result::as_mut`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.as_mut )
- [`Result::<&_, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied )
- [`Result::<&mut _, _>::copied`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.copied-1 )
- [`Result::<Option<_>, _>::transpose`](https://doc.rust-lang.org/stable/core/result/enum.Result.html#method.transpose )
- [`UnsafeCell::get_mut`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.get_mut )
- [`UnsafeCell::into_inner`](https://doc.rust-lang.org/stable/core/cell/struct.UnsafeCell.html#method.into_inner )
- [`array::from_mut`](https://doc.rust-lang.org/stable/core/array/fn.from_mut.html )
- [`char::encode_utf8`](https://doc.rust-lang.org/stable/core/primitive.char.html#method.encode_utf8 )
- [`{float}::classify`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.classify )
- [`{float}::is_finite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_finite )
- [`{float}::is_infinite`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_infinite )
- [`{float}::is_nan`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_nan )
- [`{float}::is_normal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_normal )
- [`{float}::is_sign_negative`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_negative )
- [`{float}::is_sign_positive`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_sign_positive )
- [`{float}::is_subnormal`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.is_subnormal )
- [`{float}::from_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_bits )
- [`{float}::from_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_be_bytes )
- [`{float}::from_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_le_bytes )
- [`{float}::from_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.from_ne_bytes )
- [`{float}::to_bits`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_bits )
- [`{float}::to_be_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_be_bytes )
- [`{float}::to_le_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_le_bytes )
- [`{float}::to_ne_bytes`](https://doc.rust-lang.org/stable/core/primitive.f64.html#method.to_ne_bytes )
- [`mem::replace`](https://doc.rust-lang.org/stable/core/mem/fn.replace.html )
- [`ptr::replace`](https://doc.rust-lang.org/stable/core/ptr/fn.replace.html )
- [`ptr::slice_from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.slice_from_raw_parts_mut.html )
- [`ptr::write`](https://doc.rust-lang.org/stable/core/ptr/fn.write.html )
- [`ptr::write_unaligned`](https://doc.rust-lang.org/stable/core/ptr/fn.write_unaligned.html )
- [`<*const _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to )
- [`<*const _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping )
- [`<*mut _>::copy_from`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from )
- [`<*mut _>::copy_from_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_from_nonoverlapping )
- [`<*mut _>::copy_to`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to-1 )
- [`<*mut _>::copy_to_nonoverlapping`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.copy_to_nonoverlapping-1 )
- [`<*mut _>::write`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write )
- [`<*mut _>::write_bytes`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_bytes )
- [`<*mut _>::write_unaligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.write_unaligned )
- [`slice::from_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_mut.html )
- [`slice::from_raw_parts_mut`](https://doc.rust-lang.org/stable/core/slice/fn.from_raw_parts_mut.html )
- [`<[_]>::first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_mut )
- [`<[_]>::last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_mut )
- [`<[_]>::first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.first_chunk_mut )
- [`<[_]>::last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.last_chunk_mut )
- [`<[_]>::split_at_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut )
- [`<[_]>::split_at_mut_checked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_checked )
- [`<[_]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked )
- [`<[_]>::split_first_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_mut )
- [`<[_]>::split_last_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_mut )
- [`<[_]>::split_first_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_first_chunk_mut )
- [`<[_]>::split_last_chunk_mut`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_last_chunk_mut )
- [`str::as_bytes_mut`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_bytes_mut )
- [`str::as_mut_ptr`](https://doc.rust-lang.org/stable/core/primitive.str.html#method.as_mut_ptr )
- [`str::from_utf8_unchecked_mut`](https://doc.rust-lang.org/stable/core/str/fn.from_utf8\_unchecked_mut.html )
<a id="1.83.0-Cargo"></a>
## Cargo
- [Introduced a new `CARGO_MANIFEST_PATH` environment variable, similar to `CARGO_MANIFEST_DIR` but pointing directly to the manifest file.](https://redirect.github.com/rust-lang/cargo/pull/14404/ )
- [Added `package.autolib` to the manifest, allowing `[lib]` auto-discovery to be disabled.](https://redirect.github.com/rust-lang/cargo/pull/14591/ )
- [Declare support level for each crate in Cargo's Charter / crate docs.](https://redirect.github.com/rust-lang/cargo/pull/14600/ )
- [Declare new Intentional Artifacts as 'small' changes.](https://redirect.github.com/rust-lang/cargo/pull/14599/ )
<a id="1.83-Rustdoc"></a>
## Rustdoc
- [The sidebar / hamburger menu table of contents now includes the `# headers` from the main item's doc comment](https://redirect.github.com/rust-lang/rust/pull/120736 ). This is similar to a third-party feature provided by the rustdoc-search-enhancements browser extension.
<a id="1.83.0-Compatibility-Notes"></a>
## Compatibility Notes
- [Warn against function pointers using unsupported ABI strings.](https://redirect.github.com/rust-lang/rust/pull/128784 )
- [Check well-formedness of the source type's signature in fn pointer casts.](https://redirect.github.com/rust-lang/rust/pull/129021 ) This partly closes a soundness hole that comes when casting a function item to function pointer
- [Use equality instead of subtyping when resolving type dependent paths.](https://redirect.github.com/rust-lang/rust/pull/129073 )
- Linking on macOS now correctly includes Rust's default deployment target. Due to a linker bug, you might have to pass `MACOSX_DEPLOYMENT_TARGET` or fix your `#[link]` attributes to point to the correct frameworks. See [#​129369](https://redirect.github.com/rust-lang/rust/pull/129369 ).
- [Rust will now correctly raise an error for `repr(Rust)` written on non-`struct`/`enum`/`union` items, since it previous did not have any effect.](https://redirect.github.com/rust-lang/rust/pull/129422 )
- The future incompatibility lint `deprecated_cfg_attr_crate_type_name` [has been made into a hard error](https://redirect.github.com/rust-lang/rust/pull/129670 ). It was used to deny usage of `#![crate_type]` and `#![crate_name]` attributes in `#![cfg_attr]`, which required a hack in the compiler to be able to change the used crate type and crate name after cfg expansion.
Users can use `--crate-type` instead of `#![cfg_attr(..., crate_type = "...")]` and `--crate-name` instead of `#![cfg_attr(..., crate_name = "...")]` when running `rustc`/`cargo rustc` on the command line.
Use of those two attributes outside of `#![cfg_attr]` continue to be fully supported.
- Until now, paths into the sysroot were always prefixed with `/rustc/$hash` in diagnostics, codegen, backtrace, e.g.
thread 'main' panicked at 'hello world', map-panic.rs:2:50
stack backtrace:
0: std::panicking::begin_panic
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:616:12
1: map_panic::main::{{closure}}
at ./map-panic.rs:2:50
2: core::option::Option<T>::map
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/option.rs:929:29
3: map_panic::main
at ./map-panic.rs:2:30
4: core::ops::function::FnOnce::call_once
at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[RFC 3127 said](https://rust-lang.github.io/rfcs/3127-trim-paths.html#changing-handling-of-sysroot-path-in-rustc )
> We want to change this behaviour such that, when `rust-src` source files can be discovered, the virtual path is discarded and therefore the local path will be embedded, unless there is a `--remap-path-prefix` that causes this local path to be remapped in the usual way.
[#​129687](https://redirect.github.com/rust-lang/rust/pull/129687 ) implements this behaviour, when `rust-src` is present at compile time, `rustc` replaces `/rustc/$hash` with a real path into the local `rust-src` component with best effort.
To sanitize this, users must explicitly supply `--remap-path-prefix=<path to rust-src>=foo` or not have the `rust-src` component installed.
- The allow-by-default `missing_docs` lint used to disable itself when invoked through `rustc --test`/`cargo test`, resulting in `#[expect(missing_docs)]` emitting false positives due to the expectation being wrongly unfulfilled. This behavior [has now been removed](https://redirect.github.com/rust-lang/rust/pull/130025 ), which allows `#[expect(missing_docs)]` to be fulfilled in all scenarios, but will also report new `missing_docs` diagnostics for publicly reachable `#[cfg(test)]` items, [integration test](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#integration-tests ) crate-level documentation, and publicly reachable items in integration tests.
- [The `armv8r-none-eabihf` target now uses the Armv8-R required set of floating-point features.](https://redirect.github.com/rust-lang/rust/pull/130295 )
- [Fix a soundness bug where rustc wouldn't detect unconstrained higher-ranked lifetimes in a `dyn Trait`'s associated types that occur due to supertraits.](https://redirect.github.com/rust-lang/rust/pull/130367 )
- [Update the minimum external LLVM version to 18.](https://redirect.github.com/rust-lang/rust/pull/130487 )
- [Remove `aarch64-fuchsia` and `x86_64-fuchsia` target aliases in favor of `aarch64-unknown-fuchsia` and `x86_64-unknown-fuchsia` respectively.](https://redirect.github.com/rust-lang/rust/pull/130657 )
- [The ABI-level exception class of a Rust panic is now encoded with native-endian bytes, so it is legible in hex dumps.](https://redirect.github.com/rust-lang/rust/pull/130897 )
- [Visual Studio 2013 is no longer supported for MSVC targets.](https://redirect.github.com/rust-lang/rust/pull/131070 )
- [The sysroot no longer contains the `std` dynamic library in its top-level `lib/` dir.](https://redirect.github.com/rust-lang/rust/pull/131188 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2024-11-29 07:25:36 +00:00
Boshen
d942a8d41a
chore: Rust v1.83.0 changes ( #7535 )
...
This PR does not upgrade rustc. Only changes are applied.
We cannot upgrade to the lastet Rust version yet due to wasm-bindgen
breaking some generated types.
THere's also some elided lifetimes in `**/generated/**`, which requires
modification to ast tools.
2024-11-29 11:59:45 +08:00
Boshen
b0e1c03284
feat(ast)!: add StringLiteral::raw field ( #7393 )
...
part of #7254
2024-11-26 23:33:56 +08:00
oxc-bot
00a7372eaf
release(crates): v0.38.0 ( #7490 )
2024-11-26 14:38:47 +08:00
overlookmotel
eb70219821
feat(ast): derive GetAddress on all enum types ( #7472 )
...
Implement `GetAddress` on all AST enums where all variants are boxed. Part of #7339 .
2024-11-25 12:13:44 +00:00
oxc-bot
0918e520cf
release(crates): v0.37.0 ( #7399 )
2024-11-21 22:27:55 +08:00
Boshen
224775c056
feat(transformer): transform object rest spread ( #7003 )
...
https://babel.dev/docs/babel-plugin-transform-object-rest-spread
2024-11-21 11:33:26 +00:00
Boshen
885e37f8eb
feat(transformer): Optional Chaining ( #6990 )
...
close : #6958
2024-11-21 03:12:18 +00:00
Boshen
f059b0e655
fix(ast)!: add missing ChainExpression from TSNonNullExpression ( #7377 )
...
closes #7375
* `foo?.bar!`
* `foo?.[bar]!`
`TSNonNullExpression` was not wrapped inside `ChainExpression`.
2024-11-20 15:54:28 +00:00
overlookmotel
41a0e60c3e
refactor(ast)!: remove impl GetAddress for Function ( #7343 )
...
`impl GetAddress for Function` was added as a hack, in the absence of another way to get the `Address` of a `&Function` (https://github.com/oxc-project/backlog/issues/140 ).
Remove it, and use `Address:from_ptr` instead in JSX Refresh transform, which is only place using it.
2024-11-19 01:05:31 +00:00