about summary refs log tree commit diff
path: root/crates/syntax/src/ast/make.rs
AgeCommit message (Collapse)AuthorLines
2022-05-13Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, ↵Jonas Schievink-6/+7
r=jonas-schievink" This reverts commit cc9ae2b89e01a30e441371b9fd3376c3d03a475f, reversing changes made to 7dfd1cb572d8d4fd951237361e43ecddd9c9a852.
2022-05-05Wrap float literals in their own nodeJonas Schievink-7/+6
2022-05-04improve the default constructor mode when filling fieldsBenjamin Coenen-0/+3
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-04-03fix: Add missing fields diagnostic fix for patternsLukas Wirth-0/+4
2022-03-12fix: "Extract to function" assist preserves `break` and `continue` labelsMorgan Thomas-6/+16
Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them. This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec. Closes #11413.
2022-03-12fix clippy::redundant_closureMatthias Krüger-1/+1
2022-03-05fix: Recognize `Self` as a proper keywordLukas Wirth-4/+5
2022-02-21Parse `let` expressions in order to support `let` chainsChayim Refael Friedman-9/+3
We still need to reject freestanding `let` expressions: see https://github.com/rust-analyzer/rust-analyzer/issues/11320#issuecomment-1018212465.
2022-01-22removed printsJeroen Vannevel-1/+1
2022-01-22hacky_block_expr_with_commentsJeroen Vannevel-8/+9
2022-01-22removing unwrapsJeroen Vannevel-4/+5
2022-01-22very rough but comments get extractedJeroen Vannevel-0/+23
2022-01-08Merge #11107bors[bot]-2/+10
11107: Fix generic type substitution in impl trait with assoc type r=pnevyk a=pnevyk Fixes #11045 The path transform now detects if a type parameter that is being substituted has an associated type. In that case it is necessary (or safe in general case) to fully qualify the substitution with a trait which the associated type belongs to. This PR also fixes the previous wrong behavior of the substitution that could create an invalid tree `PATH_TYPE -> PATH_TYPE -> ...`. Co-authored-by: Petr Nevyhoštěný <petr.nevyhosteny@gmail.com>
2022-01-07feat(diagnostics): use default expression instead of todo! when missing fieldsBenjamin Coenen-1/+1
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2022-01-04add better default behavior on fill struct fields diagnosticBenjamin Coenen-2/+21
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-30feat(diagnostics): use Default::default() expression instead of todo! when ↵Benjamin Coenen-0/+3
missing fields Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-23Fix generic type substitution in impl trait with assoc typePetr Nevyhoštěný-2/+10
2021-11-15Fix `impl_def_from_trait`TheDoctor314-64/+8
Revert "Fix `impl_trait` function to emit correct ast" This reverts commit 55a4813151a8f36dcdb520c45a461fe5dfbed499. Fix `impl_def_from_trait` It now generates the correct `ast::Impl` using `generate_trait_impl_text` and parses it to form the right node (copied from the private fn 'make::ast_from_text').
2021-11-11Fix `impl_trait` function to emit correct astTheDoctor314-8/+64
`impl_trait` code copied from `generate_impl_text_inner` to properly handle the bounds for the generic parameters.
2021-11-10Add generic parameters for manual impl assistTheDoctor314-2/+7
The `impl_trait` function takes an optional `GenericParamList` to create the trait impl.
2021-10-16feat: Adding extract_module assistvi_mi-0/+6
2021-10-14Merge #10546bors[bot]-0/+13
10546: feat: Implement promote_local_to_const assist r=Veykril a=Veykril Fixes #7692, that is now one can invoke the `extract_variable` assist on something and then follow that up with this assist to turn it into a const. bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-14Implement promotoe_local_to_const assistLukas Wirth-0/+13
2021-10-14Enable delegation generation for complex typesYoshua Wuyts-3/+24
2021-10-13Add basic support for delegationRyan Levick-0/+4
2021-10-05Merge #10440bors[bot]-4/+9
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537](https://github.com/rust-lang/rust-clippy/issues/5537) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159)), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn. I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely. Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05Replace `if let` with `match` where appropriateAramis Razzaghipour-3/+8
2021-10-03Add semicolons for consistencyAramis Razzaghipour-1/+1
`clippy::semicolon_if_nothing_returned`
2021-10-03fix: await insertion with try_expr during extract_functionvi_mi-0/+3
2021-09-26internal: more reasonable grammar for blocksAleksey Kladov-0/+1
Consider these expples { 92 } async { 92 } 'a: { 92 } #[a] { 92 } Previously the tree for them were BLOCK_EXPR { ... } EFFECT_EXPR async BLOCK_EXPR { ... } EFFECT_EXPR 'a: BLOCK_EXPR { ... } BLOCK_EXPR #[a] { ... } As you see, it gets progressively worse :) The last two items are especially odd. The last one even violates the balanced curleys invariant we have (#10357) The new approach is to say that the stuff in `{}` is stmt_list, and the block is stmt_list + optional modifiers BLOCK_EXPR STMT_LIST { ... } BLOCK_EXPR async STMT_LIST { ... } BLOCK_EXPR 'a: STMT_LIST { ... } BLOCK_EXPR #[a] STMT_LIST { ... }
2021-09-19SimplifyLukas Wirth-1/+1
2021-09-16assists: turn while into loopAndrzej Głuszak-0/+5
2021-09-04fix: use placeholder as default type in `Generate function`.Dawer-0/+3
2021-08-14internal: merge hir::BinaryOp and ast::BinOpAleksey Kladov-1/+2
2021-08-12add `make::ext::path_from_idents`Yoshua Wuyts-0/+12
2021-08-10add make::expr_opYoshua Wuyts-0/+3
2021-08-09generate method assistmahdi-frms-0/+4
2021-08-08generate Debug for enumsYoshua Wuyts-0/+3
2021-08-08debug for record field structsYoshua Wuyts-0/+3
2021-08-07SimplifyLukas Wirth-1/+9
2021-07-10Respect coercions in `inline_call`Lukas Wirth-4/+13
2021-07-09fix: Adding async keyword when await is present in generate_function assistvi_mi-2/+5
2021-07-03Merge the inline function/method assists into `inline_call`Lukas Wirth-2/+1
2021-07-03feat: Implement `inline_method` assistLukas Wirth-11/+17
2021-07-02Remove make::match_arm_with_guardLukas Wirth-2/+9
2021-07-02Handle not let if expressions in replace_if_let_with_matchLukas Wirth-0/+13
2021-06-02Account for generics in extract_struct_from_enum_variantLukas Wirth-3/+2
2021-05-22internal: replace AstTransformer with mutable syntax treesAleksey Kladov-0/+4
2021-05-14internal: rewrite assoc item manipulaion to use mutable treesAleksey Kladov-1/+1
2021-05-14internal: remove one more immutable treeAleksey Kladov-8/+2