Giga Bowser
a5a79f5957
internal: Migrate unwrap_return_type
assist to use SyntaxEditor
...
Also changes `make::expr_empty_block()` to return `ast::BlockExpr` instead of `ast::Expr`
2025-01-08 18:12:06 -06:00
Giga Bowser
651b43e551
internal: Migrate wrap_return_type
assist to use SyntaxEditor
2025-01-08 15:19:10 -06:00
Giga Bowser
796041acce
internal: Add some pattern constructors to SyntaxFactory
2025-01-06 15:58:39 -06:00
Giga Bowser
ce2398fee8
internal: Add some expr constructors to SyntaxFactory
2025-01-06 15:58:39 -06:00
Giga Bowser
f5ff966dea
internal: Add some path constructors to SyntaxFactory
2025-01-06 15:58:39 -06:00
Giga Bowser
551f1d00dd
internal: make::expr_match
should return ast::MatchExpr
2025-01-06 15:58:39 -06:00
Giga Bowser
32ff06d51c
internal: Generally improve make::match_arm
...
`make::match_arm` should take a single `ast::Pat`, and callers can handle creating an `ast::OrPat` if need be. It should also take a proper `ast::MatchGuard`, instead of making one itself.
2025-01-06 15:58:39 -06:00
Giga Bowser
905e1e1fc0
internal: move make::expr_unit
to make::ext::expr_unit
...
`expr_unit` is just a shortcut for a common expression, so it belongs in `make::ext`
2025-01-06 15:58:39 -06:00
Giga Bowser
f388482119
internal: make::expr_tuple
should return ast::TupleExpr
2025-01-06 15:32:08 -06:00
Giga Bowser
c549be9ab6
internal: make::expr_if
should return ast::IfExpr
2025-01-06 15:32:08 -06:00
Giga Bowser
913d197a04
internal: make::expr_prefix
should return ast::PrefixExpr
2025-01-06 15:32:08 -06:00
Giga Bowser
159731022f
internal: Generalize make::expr_from_text
to types which implement Into<ast::Expr>
...
This will help with specializing the various `make::expr_*` functions later
2025-01-06 15:32:08 -06:00
Lukas Wirth
4b6007115a
minor: New clippy lints
2025-01-06 17:57:17 +01:00
Chayim Refael Friedman
ce323627c5
Support the new CoercePointee
derive
2025-01-04 18:35:53 +02:00
Chayim Refael Friedman
791a63255b
Move some more AST makers to the quote macro
...
And implement addons as necessary.
There are many more makers to be moved, and I'm not completely satisfied with this (due to the ease of making a mistake in the AST structure, and slightly less but also because of the need to remember whitespaces), but this is already enough to see how this will look like.
2024-12-30 05:46:06 +02:00
Chayim Refael Friedman
abd7263179
Create a quote!
-like API for crafting AST nodes
...
Instead of messing with textual `make`.
And port one `make` helper to it, for the sake of testing.
2024-12-30 04:54:39 +02:00
Chayim Refael Friedman
737500137f
Generate a method for static retrieval of the SyntaxKind of a node, where possible
...
This will help for the quote macro for `ast::make`.
2024-12-30 03:13:17 +02:00
Giga Bowser
2b6e7ce896
internal: Standardize how we take iterator parameters in SyntaxFactory
2024-12-20 12:06:27 -05:00
Arthur Baars
cb2829eaa7
Fix AsmOption rule in rust.ungram
2024-12-18 14:56:00 +01:00
Giga Bowser
135e71fcb3
minor: Add item_static
constructor to SyntaxFactory
2024-12-11 10:32:32 -05:00
Giga Bowser
27a2f9d594
minor: Add item_const
constructor to SyntaxFactory
2024-12-11 09:52:03 -05:00
Lukas Wirth
41f3319173
Merge pull request #18458 from Giga-Bowser/master
...
feat: Add diagnostic fix to remove unnecessary wrapper in type mismatch
2024-12-11 07:09:15 +00:00
Giga Bowser
547f75a2ce
minor: Migrate generate_enum_variant
to SyntaxEditor
2024-12-10 13:11:33 -05:00
Giga Bowser
21b376583a
minor: Add ty_infer
constructor to SyntaxFactory
2024-12-10 12:33:32 -05:00
Giga Bowser
d7d68310c0
minor: Add whitespace
constructor to SyntaxFactory
2024-12-10 12:25:13 -05:00
Giga Bowser
c70bf568bb
minor: Add item_enum
constructor to SyntaxFactory
...
I recursively added all constructors it depends on. I also changed the old `make::` constructors to support more of the grammar.
2024-12-10 11:12:44 -05:00
Giga Bowser
68b85ce66f
minor: Migrate remove_unnecessary_wrapper
to SyntaxEditor
2024-12-09 21:16:31 -05:00
Giga Bowser
59cd717602
fix: Handle the final statement in SyntaxFactory::block_expr
properly
...
This caused a bug that was rather tricky to hunt down!
2024-12-09 21:15:15 -05:00
Giga Bowser
e66b4f336d
fix: Map new replacement nodes to their mutable equivalents in SyntaxEditor
2024-12-08 15:55:34 -05:00
Giga Bowser
8fd7790eb5
minor: Add token_tree
constructor to SyntaxFactory
2024-12-06 10:03:09 -05:00
Giga Bowser
fbb392062a
minor: Add expr_bin
constructor to SyntaxFactory
2024-12-06 10:02:34 -05:00
Giga Bowser
6406048626
minor: Add token
constructor to SyntaxFactory
2024-12-06 10:02:34 -05:00
Giga Bowser
5eb8affdc5
fix: Don't produce ChangedAncestor
for SyntaxToken
s
2024-12-06 10:01:34 -05:00
Giga Bowser
ff1124918e
fix: Properly determine SyntaxEditor
replacement intersection
...
Bordering replacements should not be considered intersecting
2024-12-06 10:01:34 -05:00
Lukas Wirth
4b350f2f11
Merge pull request #18551 from ShoyuVanilla/migrate-turbofish-assist
...
Migrate `add_turbo_fish` to `SyntaxEditor`
2024-12-06 13:44:54 +00:00
David Barsky
2fd06545a6
Merge pull request #18483 from tareknaser/syntax_factory_introduce_named_generic
...
Migrate `introduce_named_generic` Assist to Use `SyntaxFactory`
2024-12-05 18:42:27 +00:00
Tarek
8954a7f9e9
fix: rename syntax_editor_add_generic_param
to add_generic_param
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-05 13:50:43 +02:00
Tarek
9157761f5d
refactor: move editing for ast using SyntaxEditor
to a separate file
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:51:48 +02:00
Tarek
2fb563f192
fix: refactor introduce_named_generic
assist
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
5aaffe6dc9
fix: correct token type for closing angle bracket
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
70ef2f23c2
fix: refactor syntax_editor_add_generic_param
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
54f7ed13f5
fix: refactor syntax_editor_add_generic_param
to handle adding new generic parameters
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
98e10d76ca
fix: refactor syntax_editor_add_generic_param to handle new generic parameters
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
0990d5956d
fix: implement syntax_editor_create_generic_param_list
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
642d4f3385
define syntax_editor_add_generic_param
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
1400aec433
feat: migrate introduce_named_generic assist to use SyntaxFactory
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Chayim Refael Friedman
5f25ae3d1b
Lay the foundation for diagnostics in ty lowering, and implement a first diagnostic
...
The diagnostic implemented is a simple one (E0109). It serves as a test for the new foundation.
This commit only implements diagnostics for type in bodies and body-carrying signatures; the next commit will include diagnostics in the rest of the things.
Also fix one weird bug that was detected when implementing this that caused `Fn::(A, B) -> C` (which is a valid, if bizarre, alternative syntax to `Fn(A, B) -> C` to lower incorrectly.
And also fix a maybe-bug where parentheses were sneaked into a code string needlessly; this was not detected until now because the parentheses were removed (by the make-AST family API), but with a change in this commit they are now inserted. So fix that too.
2024-12-04 14:22:56 +02:00
Lukas Wirth
65c0b29720
Fix parsing of parenthesized type args and RTN
2024-12-04 11:48:47 +01:00
Shoyu Vanilla
6aa5ea5411
Migrate add_turbo_fish
to SyntaxEditor
2024-11-26 01:47:15 +09:00
Lukas Wirth
bb3239d415
Merge pull request #18385 from Giga-Bowser/master
...
feat: Add assist to generate a type alias for a function
2024-10-30 09:36:55 +00:00