overlookmotel
cacfb9b326
refactor(traverse): use symbol_id etc methods ( #7129 )
...
Utilize the methods added in #7127 in `oxc_traverse`.
2024-11-05 02:25:28 +00:00
overlookmotel
fdfd9a4378
refactor(transformer): use scope_id etc methods ( #7128 )
...
Utilize the methods added in #7127 in transformer.
2024-11-05 02:25:27 +00:00
overlookmotel
cc8a1917e5
feat(ast): methods on AST nodes to get scope_id etc ( #7127 )
...
Add getter and setter methods to all AST types which have a `ScopeId`, `SymbolId` or `ReferenceId` field to get the contents of that field.
Before:
```rs
let symbol_id = ident.symbol_id.get().unwrap();
```
After:
```rs
let symbol_id = ident.symbol_id();
```
This allows removing boilerplate code from the transformer, and discouraging the anti-pattern of treating these fields as if they may contain either `Some` or `None` (after semantic, they will always be `Some`).
2024-11-05 02:25:27 +00:00
overlookmotel
843bce4d92
refactor(ast)!: IdentifierReference::reference_id return ReferenceId ( #7126 )
...
Alter `IdentifierReference::reference_id` to return `ReferenceId`, instead of `Option<ReferenceId>`.
This method is only useful on a post-semantic AST, where it will never return `None`. Returning `ReferenceId` discourages the anti-pattern of treating the result as if it could be either `Some` or `None`, and shortens code.
2024-11-05 02:25:27 +00:00
Dunqing
ff8bd50d38
refactor(transformer): move implementation of ArrowFunction to common/ArrowFunctionConverter ( #7107 )
...
Part of #7074
In order can reuse the ability of the `ArrowFunction` plugin, we moved out the implementation to common, then we can use use in other plugins
2024-11-04 16:32:50 +00:00
Dunqing
e04ee97870
refactor(transformer/async-generator-functions): move handling of MethodDefinition's value to exit_function ( #7106 )
...
Part of #7074
I have mentioned the reason why I need to move this in https://github.com/oxc-project/oxc/pull/7105
2024-11-04 16:27:21 +00:00
overlookmotel
ae692d70df
fix(transformer/async_to_generator): fix checking if function is class method ( #7117 )
...
Follow-on after #7105 .
Correctly identify when a function is a method definition. `ctx.parent().is_method_definition()` would return `true` for this weird case where the function is the property key of the method, not the method itself:
```js
class C {
[async function() {}]() {}
}
```
`matches!(ctx.parent(), Ancestor::MethodDefinitionValue(_))` only returns `true` if the function *is* a method definition. Of course, no-one would write such ridiculous code, but we may as well handle whatever is thrown at us.
It's also slightly more performant to check for one specific ancestor type, rather than:
c2802e63fc/crates/oxc_traverse/src/generated/ancestor.rs (L1319-L1326)
2024-11-04 15:46:12 +00:00
renovate[bot]
8e90790a60
chore(deps): update rust crates ( #7115 )
2024-11-04 23:34:51 +08:00
Boshen
fc6dc52b72
ci(clippy): install ast-grep via npm ( #7119 )
2024-11-04 23:34:06 +08:00
Boshen
c2802e63fc
feat(transform_conformance): add babel runtime to exec tests ( #7114 )
2024-11-04 14:38:15 +00:00
Dunqing
f80085c683
refactor(transformer/async-to-generator): move handling of MethodDefinition's value to exit_function ( #7105 )
...
Part of #7074
We need to handle this before the `arrow_function` plugin inserts `_this = this` because, in the `async-to-generator` plugin, we will move the body to an inner generator function. However, we don't want `_this = this` moved to the inner generator function as well. So as long as we move first, and then insert, we can fix this problem.
The new semantic error is related to another tricky problem, I will fix it in another PR
2024-11-04 14:32:42 +00:00
Boshen
50646a49ea
refactor(tasks/website): remove scraper dependency ( #7116 )
2024-11-04 14:16:11 +00:00
oxc-bot
12a6952782
release(crates): v0.35.0 ( #7110 )
...
## [0.35.0] - 2024-11-04
- f543a8d ast: [**BREAKING**] Remove `AstBuilder::*_from_*` methods
(#7073 ) (overlookmotel)
- b8daab3 transformer: [**BREAKING**] API to `TryFrom<&EnvOptions> for
TransformOptions` and `TryFrom<&BabelOptions> TransformOptions` (#7020 )
(Boshen)
- 9a6a2f9 semantic: [**BREAKING**] Remove
`SymbolTable::get_symbol_id_from_span` API (#6955 ) (Boshen)
### Features
- 854870e ast: Label AST fields with #[ts] (#6987 ) (ottomated)
- ce5b609 ast: Remove explicit untagged marker on enums (#6915 )
(ottomated)
- 9725e3c ast_tools: Add #[estree(always_flatten)] to Span (#6935 )
(ottomated)
- fbc297e ast_tools: Move tsify custom types to estree attribute macro
(#6934 ) (ottomated)
- 169fa22 ast_tools: Default enums to rename_all = "camelCase" (#6933 )
(ottomated)
- caa4b1f codegen: Improve printing of comments (#7108 ) (Boshen)
- 001058a codegen: Always print legal comments on its own line (#7089 )
(Boshen)
- 413973d codegen: Print linked and external legal comment (#7059 )
(Boshen)
- ee27b92 codegen: Print eof legal comments (#7058 ) (Boshen)
- 6516f9e codegen: Print inline legal comments (#7054 ) (Boshen)
- 1e2f012 linter: Add `oxc/no-map-spread` (#6751 ) (DonIsaac)
- 6d97af4 rust: Use `oxc-miette` (#6938 ) (Boshen)
- bfdbcf1 transformer: Add `EnvOptions::from_browerslist_query` API
(#7098 ) (Boshen)
- 21b8e49 transformer: Add `ESTarget` (#7091 ) (Boshen)
- fcaba4a transformer: Add `TransformerOptions::env` with `EnvOptions`
(#7037 ) (Boshen)
- 1d906c6 transformer: Class properties transform skeleton (#7038 )
(overlookmotel)
- 934cb5e transformer: Add `async_generator_functions` plugin (#6573 )
(Dunqing)
### Bug Fixes
- 0601271 ast: Fix `StaticMemberExpression.get_first_object` (#6969 )
(tomoya yanagibashi)
- da199c7 ecmascript: Allow getting PropName for object methods (#6967 )
(camchenry)
- f5a7134 linter/no-unused-vars: False positive for discarded reads
within sequences (#6907 ) (DonIsaac)
- 9ed9501 module_lexer: Add missing `export * from 'foo';` case (#7103 )
(Boshen)
- d15e408 napi/transform: Fix 'typescript.declaration' option not
working (#7012 ) (Boshen)
- dcdb9ea napi/transform: Fix test (Boshen)
- caaf00e parser: Fix incorrect parsed `TSIndexSignature` (#7016 )
(Boshen)
- b188b4a transformer: Fix typescript globals being recognized as
globals (#7100 ) (Boshen)
- a2244ff transformer/async-to-generator: Output is incorrect when arrow
function without params (#7052 ) (Dunqing)
- 7d12669 types: Move @oxc-project/types to dependencies (#6909 )
(ottomated)
### Performance
- 6ca01b9 ast: Reduce size of `Comment` (#6921 ) (overlookmotel)
- c58ec89 data_structures: Optimize `NonEmptyStack::pop` (#7021 )
(overlookmotel)
- fa9a4ec parser: Check `.` before `[` in `parse_member_expression_rest`
(#6979 ) (Boshen)
### Refactor
- b0211a1 ast: `StaticMemberExpression::get_first_object` use loop
instead of recursion (#7065 ) (overlookmotel)
- fc07458 ast: Move custom types `.d.ts` file (#6931 ) (overlookmotel)
- c41c013 ast: Rename lifetime (#6922 ) (overlookmotel)
- 335eb38 ast_tools: Faster formatting Rust code (#6972 ) (overlookmotel)
- 4cf0085 ast_tools: Reorder imports in generated code (#6926 )
(overlookmotel)
- dd79c1b codegen: Replace `daachorse` with string match for annotation
comment (#7064 ) (Boshen)
- 0bb1aa4 codegen: Move options to its own file (#7053 ) (Boshen)
- b021147 data_structures: Make all methods of `NonNull` shim
`#[inline(always)]` (#7024 ) (overlookmotel)
- fb1710a data_structures: Add `#[repr(transparent)]` to `NonNull` shim
(#7023 ) (overlookmotel)
- f1fc8db data_structures: Add `read` method to `NonNull` shim (#7022 )
(overlookmotel)
- cea0e6b isolated_declarations: Do not use `AstBuilder::*_from_*`
methods (#7071 ) (overlookmotel)
- 97caae1 minifier: Do not use `AstBuilder::*_from_*` methods (#7072 )
(overlookmotel)
- 2c7ac29 minifier: Remove `Tri`, use `Option<bool>` instead (#6912 )
(Boshen)
- 9926990 napi: Move custom types to bottom of file (#6930 )
(overlookmotel)
- 23157bd napi: Types file in root of types package (#6929 )
(overlookmotel)
- 953b051 parser: Remove `oxc_ecmascript` crate (#7109 ) (Boshen)
- fdd480d parser: Do not use `AstBuilder::*_from_*` methods (#7068 )
(overlookmotel)
- 9e85b10 parser: Add `ParserImpl::alloc` method (#7063 ) (overlookmotel)
- 17a938e parser: Use function `parse_type_member_semicolon` (#7018 )
(Boshen)
- aa1b29c parser: Remove `parse_ts_index_signature_member` function
(#7017 ) (Boshen)
- 7f1d1fe transform: Deserialize `BabelPreests::env` directly (#7051 )
(Boshen)
- 76947e2 transform: Refactor Babel Targets (#7026 ) (Boshen)
- d03e622 transformer: Do not use `AstBuilder::*_from_*` methods (#7070 )
(overlookmotel)
- 9d384ad transformer: Use `identifier_reference_with_reference_id`
builder method (#7056 ) (overlookmotel)
- 4688a06 transformer: Use `*_with_scope_id` builder methods where
possible (#7055 ) (overlookmotel)
- 7122e00 transformer: Use `ctx.alloc` over `ctx.ast.alloc` where
possible (#7066 ) (overlookmotel)
- a3b68b4 transformer: Flatten dir structure of options/babel/env
(#7049 ) (Boshen)
- 6d92f36 transformer: Deserialize `BabelOptions::compiler_assumptions`
(#7048 ) (Boshen)
- f83a760 transformer: Deserialize `BabelOptions::presets` (#7047 )
(Boshen)
- 52c20d6 transformer: Deserialize `BabelOptions::plugins` (#7045 )
(Boshen)
- e921df6 transformer: Rename `EnvOptions` to `BabelEnvOptions` (#7036 )
(Boshen)
- af5140f transformer: Isolate babel options logic (#7034 ) (Boshen)
- 12aa910 transformer: Clean up `env/targets/query.rs` (#7033 ) (Boshen)
- 3d174bb transformer: Clean up `BabelOptions` (#7029 ) (Boshen)
- 6284f84 transformer: Use `Browserslist::Version` (#7028 ) (Boshen)
- 5b11cdf transformer: Clean up TransformerOptions (#7005 ) (Boshen)
- f0c87d4 transformer: Mark all EnvOptions as not implemented (#7004 )
(Boshen)
- d9edef6 transformer: Combine ObjectRestSpread into a single file
(#7002 ) (Boshen)
- c945fe7 transformer: Import `oxc_allocator::Box` as `ArenaBox` (#6999 )
(overlookmotel)
- fc1af2e transformer: Import `oxc_allocator::Vec` as `ArenaVec` (#6998 )
(overlookmotel)
- 63e8bfe transformer: Rename `AString` to `ArenaString` (#6997 )
(overlookmotel)
- 562bb9a transformer/async-to-generator: Move transform methods to
`AsyncGeneratorExecutor` and make it public (#6992 ) (Dunqing)
- e23f7e6 transformer/common: `VarDeclarations` insert either `var` or
`let` statements (#7043 ) (overlookmotel)
- e5ecbb9 transformer/jsx: Return `&mut T` not `&mut ArenaBox<T>`
(#7001 ) (overlookmotel)
- 9e66c29 transformer/react-refresh: Small refactor (#6973 )
(overlookmotel)
- 1ca8cd2 transformer/react-refresh: Avoid panic for `init` of
`VariableDeclarator` isn't a `BindingIdentifier` (#6937 ) (Dunqing)
- 5f153ac transformer/react-refresh: Use `VarDeclarations` to insert
declarators (#6884 ) (Dunqing)
- df3b089 transformer/react-refresh: Use `StatementInjector` to insert
statements (#6881 ) (Dunqing)
- ae22671 transformer/typescript: Pass `&mut T` not `&mut ArenaBox<T>`
(#7000 ) (overlookmotel)
- 938ee87 traverse: Do not use `AstBuilder::*_from_*` methods (#7069 )
(overlookmotel)
### Styling
- 86ab091 transformer/common: Split up `StatementInjectorStore` methods
into blocks (#7042 ) (overlookmotel)
### Testing
- 64e2499 module_lexer: Use a single integration test for faster
compilation (#7097 ) (Boshen)
- 6133a50 transformer: Use a single integration test for faster
compilation (#7099 ) (Boshen)
---------
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-04 17:40:05 +08:00
Boshen
40d8acfbd1
feat(codegen): improvement printing of legal comments ( #7111 )
2024-11-04 08:56:00 +00:00
Boshen
03a30856c4
chore(transformer): disable snapshot test in miri
2024-11-04 16:54:52 +08:00
Boshen
953b0516e8
refactor(parser): remove oxc_ecmascript crate ( #7109 )
2024-11-04 16:29:26 +08:00
Boshen
caa4b1fd2a
feat(codegen): improve printing of comments ( #7108 )
2024-11-04 05:12:59 +00:00
tbashiyy
b73cfd992e
fix(linter): fix is_method_call with parentheses and chain expression ( #7095 )
...
I fixed `is_method_call` behavior in specific case below.
For example, when we use `is_method_call(call_expr, None,
Some(&["apply"]), Some(1), Some(1))` for
[`(a?.b.apply)(args)`](https://playground.oxc.rs/#eNpFjkEKg0AMRe+SVQviAdx057alN4gaZWBMJJmxFfHunVG0q+Qnn//fCi1UcMNH2ZQ4TX6531AHu0MBAtUKGjkPWzjgF6qgkQrwjsO5WysTXWIZG/GnCopsvegIVY/eaCtgQjXSnIjey+dNISo/YzDXUR25DU5S3+5OZqVknumFSmxHasrI7XtG2q+K89BKRwNl5iRGx653/xcHFV+n3gwwkzZiCf1g27YfdH1fTA== ),
we cannot check correctly.
This is because we don't consider `call_expr` has parentheses and chain
expression.
2024-11-04 11:12:37 +08:00
overlookmotel
25d7554ec4
refactor(ast_tools): rename visitable to is_visitable ( #7104 )
...
Pure refactor. Just rename fields and vars from `visitable` to `is_visitable`, to be more descriptive.
2024-11-03 17:20:25 +00:00
Boshen
9ed9501bcd
fix(module_lexer): add missing export * from 'foo'; case ( #7103 )
...
fixes #7039
2024-11-03 16:31:19 +00:00
Boshen
9f611a18cf
chore(transformer): fix typos s/browerslist/browserslist/
2024-11-03 21:54:54 +08:00
Boshen
b8104a2dc4
chore : bump oxc-miette to v1.0.2
2024-11-03 21:06:43 +08:00
Boshen
b188b4ad75
fix(transformer): fix typescript globals being recognized as globals ( #7100 )
...
closes #7090
2024-11-03 13:00:54 +00:00
Boshen
6133a502c6
test(transformer): use a single integration test for faster compilation ( #7099 )
2024-11-03 12:43:26 +00:00
Boshen
bfdbcf1c6a
feat(transformer): add EnvOptions::from_browerslist_query API ( #7098 )
2024-11-03 12:43:25 +00:00
Boshen
21b8e4988f
feat(transformer): add ESTarget ( #7091 )
...
closes #6982
2024-11-03 12:21:53 +00:00
Boshen
64e24994e6
test(module_lexer): use a single integration test for faster compilation ( #7097 )
2024-11-03 12:16:47 +00:00
oxc-bot
2d40b073cb
release(oxlint): v0.11.0 ( #7094 )
...
## [0.11.0] - 2024-11-03
- 9fd9f4f linter: [**BREAKING**] Sync sindresorhus/globals; removed
Object.prototype properties from builtin and es* globals (#6991 )
(Boshen)
### Features
- 6b619da editor: Listen to config file changes and trigger a
didChangeConfiguration update (#6964 ) (Nicholas Rayburn)
- 7872927 editor/vscode: Support window/showMessage event (#7085 )
(Nicholas Rayburn)
- 2184588 linter: Do not bail for unmatched rules yet (#7093 ) (Boshen)
- a6fcd81 linter: Add `import/no-commonjs` rule (#6978 ) (Dmitry
Zakharov)
- 1691cab linter: Support user-configurable secrets for
`oxc-security/api-keys` (#5938 ) (DonIsaac)
- 610621c linter: Implement `react/style-prop-object` (#6342 ) (Albert
Kaaman)
- 1e2f012 linter: Add `oxc/no-map-spread` (#6751 ) (DonIsaac)
- 1c66473 linter: Implement `eslint/prefer-object-has-own` (#6905 )
(tomoya yanagibashi)
### Bug Fixes
- ebf3753 editor: Fix onConfigChange to send the correct config for
didChangeConfiguration notification (#6962 ) (Nicholas Rayburn)
- 79bf74a linter: Check is_reference_to_global_variable in
`no-array-constructor` (#7067 ) (Naoya Yoshizawa)
- 38d1f78 linter: Remove confusing help text for now (#7081 ) (Cam
McHenry)
- 147e2e4 linter: Allow replacing rule when none are enabled yet (#7014 )
(camchenry)
- 7aa496a linter: Remove unsafe fixer of `no-useless-spread` (#6655 )
(dalaoshu)
- f5a7134 linter/no-unused-vars: False positive for discarded reads
within sequences (#6907 ) (DonIsaac)
### Documentation
- 4551baa linter: Document `rules` (#6983 ) (Boshen)
### Refactor
- a8dc75d linter: Remove unused CLI result types (#7088 ) (camchenry)
- 8f1460e linter: Move `LintPlugins` from `LintOptions` to `LintConfig`
(#6932 ) (DonIsaac)
### Testing
- c35d3f2 linter: Improve test failure output (#6975 ) (camchenry)
---------
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-03 11:27:30 +08:00
Boshen
218458811b
feat(linter): do not bail for unmatched rules yet ( #7093 )
...
I intend to make a release today, let's hold onto this behaviour.
2024-11-03 11:18:36 +08:00
Nicholas Rayburn
7872927fca
feat(editor/vscode): Support window/showMessage event ( #7085 )
...
Whenever the language server sends a `window/showMessage` event, VS Code
will listen and display a notification or log a message based on the
severity level of the message.
The language server doesn't currently send this event. I'm going to
follow up with a separate PR for that.
Ref https://github.com/oxc-project/oxc/issues/6988
2024-11-03 09:32:27 +08:00
Naoya Yoshizawa
79bf74a1a1
fix(linter): check is_reference_to_global_variable in no-array-constructor ( #7067 )
...
Hello,
I am currently reading through the code as I work on contributing by
creating some ESLint rules.
Along the way, I noticed an incompatibility in certain cases within the
`no-array-constructor` rule.
In this PR, I added test cases and modified the code to include a check
for is_reference_to_global_variable.
The relevant ESLint behavior can be verified in the following
playground.
https://eslint.org/play/#eyJ0ZXh0IjoiLyplc2xpbnQgbm8tYXJyYXktY29uc3RydWN0b3I6IFwiZXJyb3JcIiovXG5cbi8vIGlmIGNvbW1lbnQgb3V0IGJlbG93LCBuZXh0IGxpbmUgYXMgZXJyb3JcbnZhciBBcnJheTsgbmV3IEFycmF5KCk7XG5cbm5ldyBBcnJheSgpOyIsIm9wdGlvbnMiOnsicnVsZXMiOnt9LCJsYW5ndWFnZU9wdGlvbnMiOnsic291cmNlVHlwZSI6Im1vZHVsZSIsInBhcnNlck9wdGlvbnMiOnsiZWNtYUZlYXR1cmVzIjp7fX19fX0=
2024-11-02 18:17:48 +00:00
Dunqing
70e2582726
ci(transformer): enable unfinished plugins in benchmark ( #7040 )
...
Even the plugins are unfinished, we still want to enable all of them to track the performance changes during the development.
2024-11-02 15:17:21 +00:00
Boshen
001058a8e4
feat(codegen): always print legal comments on its own line ( #7089 )
2024-11-02 15:55:23 +08:00
camchenry
a8dc75d6ba
refactor(linter): remove unused CLI result types ( #7088 )
...
It doesn't seem like we should implement type checking or formatting in the `oxlint` binary. Plus, these are unused currently. So I removed them.
2024-11-02 06:17:28 +00:00
Boshen
dd79c1bfb3
refactor(codegen): replace daachorse with string match for annotation comment ( #7064 )
2024-11-02 14:16:10 +08:00
Boshen
413973df66
feat(codegen): print linked and external legal comment ( #7059 )
...
part of #7050
2024-11-02 04:08:14 +00:00
Cam McHenry
38d1f78754
fix(linter): remove confusing help text for now ( #7081 )
...
It's possible that the rule may not exist at all, or it's part of a
disabled plugin. The help text doesn't give a clue as to which is the
case currently, so it's probably less confusing to just omit it
completely.
2024-11-02 11:50:42 +08:00
overlookmotel
f543a8d495
refactor(ast)!: remove AstBuilder::*_from_* methods ( #7073 )
...
Remove `AstBuilder::*_from_*` methods for constructing enums. In my opinion, it's not a great pattern, and this removes 2000 of lines of code from [ast_builder.rs](https://github.com/oxc-project/oxc/pull/7073/files#diff-e34fd45077ed0a48b7fee440fdbe4c22a01d787a70a311afebfc1d310785fb70 ).
2024-11-02 01:22:56 +00:00
overlookmotel
97caae16e2
refactor(minifier): do not use AstBuilder::*_from_* methods ( #7072 )
...
Preparation for #7073 . Avoid using `AstBuilder::*_from_*` methods to construct enums, use explicit construction instead.
Before:
```rs
let ident = self.ast.binding_pattern_kind_from_binding_identifier(ident);
```
After:
```rs
let ident = BindingPatternKind::BindingIdentifier(ident);
```
Often this produces shorter code, as well as (in my opinion) being easier to read.
2024-11-02 01:22:56 +00:00
overlookmotel
cea0e6b62f
refactor(isolated_declarations): do not use AstBuilder::*_from_* methods ( #7071 )
...
Preparation for #7073 . Avoid using `AstBuilder::*_from_*` methods to construct enums, use explicit construction instead.
Before:
```rs
let ident = self.ast.binding_pattern_kind_from_binding_identifier(ident);
```
After:
```rs
let ident = BindingPatternKind::BindingIdentifier(ident);
```
Often this produces shorter code, as well as (in my opinion) being easier to read.
2024-11-02 01:22:55 +00:00
overlookmotel
d03e622b70
refactor(transformer): do not use AstBuilder::*_from_* methods ( #7070 )
...
Preparation for #7073 . Avoid using `AstBuilder::*_from_*` methods to construct enums, use explicit construction instead.
Before:
```rs
let ident = self.ast.binding_pattern_kind_from_binding_identifier(ident);
```
After:
```rs
let ident = BindingPatternKind::BindingIdentifier(ident);
```
Often this produces shorter code, as well as (in my opinion) being easier to read.
2024-11-02 01:22:55 +00:00
overlookmotel
938ee8724d
refactor(traverse): do not use AstBuilder::*_from_* methods ( #7069 )
...
Preparation for #7073 . Avoid using `AstBuilder::*_from_*` methods to construct enums, use explicit construction instead.
Before:
```rs
let ident = self.ast.binding_pattern_kind_from_binding_identifier(ident);
```
After:
```rs
let ident = BindingPatternKind::BindingIdentifier(ident);
```
Often this produces shorter code, as well as (in my opinion) being easier to read.
2024-11-02 01:22:55 +00:00
overlookmotel
fdd480d84c
refactor(parser): do not use AstBuilder::*_from_* methods ( #7068 )
...
Preparation for #7073 . Avoid using `AstBuilder::*_from_*` methods to construct enums, use explicit construction instead.
Before:
```rs
let ident = self.ast.binding_pattern_kind_from_binding_identifier(ident);
```
After:
```rs
let ident = BindingPatternKind::BindingIdentifier(ident);
```
Often this produces shorter code, as well as (in my opinion) being easier to read.
2024-11-02 01:22:55 +00:00
overlookmotel
32b4a53692
refactor(ast_tools): remove LateCtx abstraction ( #7083 )
...
`LateCtx` is just a wrapper around `Schema`. Remove it and use `Schema` instead.
2024-11-01 22:31:03 +00:00
overlookmotel
2eb9aa9b89
refactor(ast_tools): remove dead code ( #7080 )
2024-11-01 21:59:28 +00:00
overlookmotel
d89fe2c326
refactor(ast_tools): shorten code ( #7079 )
...
Shorten code by importing `rust_ast::Module` at top level.
2024-11-01 21:51:29 +00:00
overlookmotel
00cc156fb5
refactor(ast_tools): simplify module loading ( #7078 )
...
Rename var for clarity and remove unnecessary `From` impl.
2024-11-01 21:51:29 +00:00
overlookmotel
f2d10683a8
refactor(ast_tools): remove dead code ( #7077 )
2024-11-01 21:42:14 +00:00
overlookmotel
248ff18ddd
refactor(ast_tools): output progress ( #7076 )
...
Flush `stdout` after writing progress.
2024-11-01 21:26:45 +00:00
overlookmotel
9e85b104e2
refactor(parser): add ParserImpl::alloc method ( #7063 )
...
Pure refactor. Introduce `ParserImpl::alloc` method. Shorten `self.ast.alloc(...)` to `self.alloc(...)`.
Also reduce `alloc` calls by using `AstBuilder` methods which already allocate where possible.
2024-11-01 17:09:06 +00:00