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 {
127
127
ast
128
128
}
129
129
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
+
130
156
pub fn block_expr (
131
157
& self ,
132
158
statements : impl IntoIterator < Item = ast:: Stmt > ,
You can’t perform that action at this time.
0 commit comments