File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ impl ParsedRule {
78
78
builder. try_add ( ast:: Item :: parse ( & raw_pattern) , raw_template. map ( ast:: Item :: parse) ) ;
79
79
builder. try_add ( ast:: Path :: parse ( & raw_pattern) , raw_template. map ( ast:: Path :: parse) ) ;
80
80
builder. try_add ( ast:: Pat :: parse ( & raw_pattern) , raw_template. map ( ast:: Pat :: parse) ) ;
81
+ builder. try_add ( ast:: Stmt :: parse ( & raw_pattern) , raw_template. map ( ast:: Stmt :: parse) ) ;
81
82
builder. build ( )
82
83
}
83
84
}
Original file line number Diff line number Diff line change @@ -212,6 +212,13 @@ impl ast::Attr {
212
212
}
213
213
}
214
214
215
+ impl ast:: Stmt {
216
+ /// Returns `text`, parsed as statement, but only if it has no errors.
217
+ pub fn parse ( text : & str ) -> Result < Self , ( ) > {
218
+ parsing:: parse_text_fragment ( text, parser:: FragmentKind :: Statement )
219
+ }
220
+ }
221
+
215
222
/// Matches a `SyntaxNode` against an `ast` type.
216
223
///
217
224
/// # Example:
You can’t perform that action at this time.
0 commit comments