This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/tools/rust-analyzer/crates/syntax/src/ast/syntax_factory Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,32 @@ impl SyntaxFactory {
127127 ast
128128 }
129129
130+ pub fn wildcard_pat ( & self ) -> ast:: WildcardPat {
131+ make:: wildcard_pat ( ) . clone_for_update ( )
132+ }
133+
134+ pub fn literal_pat ( & self , text : & str ) -> ast:: LiteralPat {
135+ make:: literal_pat ( text) . clone_for_update ( )
136+ }
137+
138+ pub fn tuple_struct_pat (
139+ & self ,
140+ path : ast:: Path ,
141+ fields : impl IntoIterator < Item = ast:: Pat > ,
142+ ) -> ast:: TupleStructPat {
143+ let ( fields, input) = iterator_input ( fields) ;
144+ let ast = make:: tuple_struct_pat ( path. clone ( ) , fields) . clone_for_update ( ) ;
145+
146+ if let Some ( mut mapping) = self . mappings ( ) {
147+ let mut builder = SyntaxMappingBuilder :: new ( ast. syntax ( ) . clone ( ) ) ;
148+ builder. map_node ( path. syntax ( ) . clone ( ) , ast. path ( ) . unwrap ( ) . syntax ( ) . clone ( ) ) ;
149+ builder. map_children ( input. into_iter ( ) , ast. fields ( ) . map ( |it| it. syntax ( ) . clone ( ) ) ) ;
150+ builder. finish ( & mut mapping) ;
151+ }
152+
153+ ast
154+ }
155+
130156 pub fn block_expr (
131157 & self ,
132158 statements : impl IntoIterator < Item = ast:: Stmt > ,
You can’t perform that action at this time.
0 commit comments