Split ast::PatKind::Enum into tuple struct and path patterns
This commit is contained in:
parent
14adc9bb63
commit
9f414a44a7
8 changed files with 47 additions and 26 deletions
|
@ -827,7 +827,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
self.pat(span, pat)
|
||||
}
|
||||
fn pat_enum(&self, span: Span, path: ast::Path, subpats: Vec<P<ast::Pat>>) -> P<ast::Pat> {
|
||||
let pat = PatKind::Enum(path, Some(subpats));
|
||||
let pat = if subpats.is_empty() {
|
||||
PatKind::Path(path)
|
||||
} else {
|
||||
PatKind::TupleStruct(path, Some(subpats))
|
||||
};
|
||||
self.pat(span, pat)
|
||||
}
|
||||
fn pat_struct(&self, span: Span,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue