use recrod terminology for hir::Pat
This commit is contained in:
parent
db69d134fb
commit
48ffbf29b7
@ -472,7 +472,7 @@ pub enum Pat {
|
|||||||
Missing,
|
Missing,
|
||||||
Wild,
|
Wild,
|
||||||
Tuple(Vec<PatId>),
|
Tuple(Vec<PatId>),
|
||||||
Struct {
|
Record {
|
||||||
path: Option<Path>,
|
path: Option<Path>,
|
||||||
args: Vec<RecordFieldPat>,
|
args: Vec<RecordFieldPat>,
|
||||||
// FIXME: 'ellipsis' option
|
// FIXME: 'ellipsis' option
|
||||||
@ -518,7 +518,7 @@ pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) {
|
|||||||
let total_iter = prefix.iter().chain(rest.iter()).chain(suffix.iter());
|
let total_iter = prefix.iter().chain(rest.iter()).chain(suffix.iter());
|
||||||
total_iter.copied().for_each(f);
|
total_iter.copied().for_each(f);
|
||||||
}
|
}
|
||||||
Pat::Struct { args, .. } => {
|
Pat::Record { args, .. } => {
|
||||||
args.iter().map(|f| f.pat).for_each(f);
|
args.iter().map(|f| f.pat).for_each(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
ArithOp, Array, BinaryOp, BindingAnnotation, Body, BodySourceMap, CmpOp, Expr, ExprId,
|
ArithOp, Array, BinaryOp, BindingAnnotation, Body, BodySourceMap, CmpOp, Expr, ExprId, Literal,
|
||||||
Literal, LogicOp, MatchArm, Ordering, Pat, PatId, PatPtr, RecordFieldPat, RecordLitField,
|
LogicOp, MatchArm, Ordering, Pat, PatId, PatPtr, RecordFieldPat, RecordLitField, Statement,
|
||||||
Statement,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) struct ExprCollector<DB> {
|
pub(crate) struct ExprCollector<DB> {
|
||||||
@ -504,7 +503,7 @@ fn collect_pat(&mut self, pat: ast::Pat) -> PatId {
|
|||||||
});
|
});
|
||||||
fields.extend(iter);
|
fields.extend(iter);
|
||||||
|
|
||||||
Pat::Struct { path, args: fields }
|
Pat::Record { path, args: fields }
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: implement
|
// FIXME: implement
|
||||||
|
@ -749,7 +749,7 @@ fn infer_pat(&mut self, pat: PatId, mut expected: &Ty, mut default_bm: BindingMo
|
|||||||
let is_non_ref_pat = match &body[pat] {
|
let is_non_ref_pat = match &body[pat] {
|
||||||
Pat::Tuple(..)
|
Pat::Tuple(..)
|
||||||
| Pat::TupleStruct { .. }
|
| Pat::TupleStruct { .. }
|
||||||
| Pat::Struct { .. }
|
| Pat::Record { .. }
|
||||||
| Pat::Range { .. }
|
| Pat::Range { .. }
|
||||||
| Pat::Slice { .. } => true,
|
| Pat::Slice { .. } => true,
|
||||||
// FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented.
|
// FIXME: Path/Lit might actually evaluate to ref, but inference is unimplemented.
|
||||||
@ -809,7 +809,7 @@ fn infer_pat(&mut self, pat: PatId, mut expected: &Ty, mut default_bm: BindingMo
|
|||||||
Pat::TupleStruct { path: ref p, args: ref subpats } => {
|
Pat::TupleStruct { path: ref p, args: ref subpats } => {
|
||||||
self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm)
|
self.infer_tuple_struct_pat(p.as_ref(), subpats, expected, default_bm)
|
||||||
}
|
}
|
||||||
Pat::Struct { path: ref p, args: ref fields } => {
|
Pat::Record { path: ref p, args: ref fields } => {
|
||||||
self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat)
|
self.infer_record_pat(p.as_ref(), fields, expected, default_bm, pat)
|
||||||
}
|
}
|
||||||
Pat::Path(path) => {
|
Pat::Path(path) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user