Rollup merge of #63542 - c410-f3r:node_ids, r=petrochenkov
Add NodeId for Arm, Field and FieldPat Extracted from #63468
This commit is contained in:
commit
d4ecc6f5c0
6 changed files with 19 additions and 3 deletions
|
@ -608,6 +608,7 @@ pub struct FieldPat {
|
|||
pub pat: P<Pat>,
|
||||
pub is_shorthand: bool,
|
||||
pub attrs: ThinVec<Attribute>,
|
||||
pub id: NodeId,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||
|
@ -925,6 +926,7 @@ pub struct Arm {
|
|||
pub guard: Option<P<Expr>>,
|
||||
pub body: P<Expr>,
|
||||
pub span: Span,
|
||||
pub id: NodeId,
|
||||
}
|
||||
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||
|
@ -934,6 +936,7 @@ pub struct Field {
|
|||
pub span: Span,
|
||||
pub is_shorthand: bool,
|
||||
pub attrs: ThinVec<Attribute>,
|
||||
pub id: NodeId,
|
||||
}
|
||||
|
||||
pub type SpannedIdent = Spanned<Ident>;
|
||||
|
|
|
@ -403,6 +403,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
span,
|
||||
is_shorthand: false,
|
||||
attrs: ThinVec::new(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
}
|
||||
}
|
||||
pub fn expr_struct(
|
||||
|
@ -612,6 +613,7 @@ impl<'a> ExtCtxt<'a> {
|
|||
guard: None,
|
||||
body: expr,
|
||||
span,
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -383,10 +383,11 @@ pub fn noop_visit_use_tree<T: MutVisitor>(use_tree: &mut UseTree, vis: &mut T) {
|
|||
}
|
||||
|
||||
pub fn noop_visit_arm<T: MutVisitor>(
|
||||
Arm { attrs, pats, guard, body, span }: &mut Arm,
|
||||
Arm { attrs, pats, guard, body, span, id }: &mut Arm,
|
||||
vis: &mut T,
|
||||
) {
|
||||
visit_attrs(attrs, vis);
|
||||
vis.visit_id(id);
|
||||
visit_vec(pats, |pat| vis.visit_pat(pat));
|
||||
visit_opt(guard, |guard| vis.visit_expr(guard));
|
||||
vis.visit_expr(body);
|
||||
|
@ -808,9 +809,10 @@ pub fn noop_visit_struct_field<T: MutVisitor>(f: &mut StructField, visitor: &mut
|
|||
}
|
||||
|
||||
pub fn noop_visit_field<T: MutVisitor>(f: &mut Field, vis: &mut T) {
|
||||
let Field { ident, expr, span, is_shorthand: _, attrs } = f;
|
||||
let Field { ident, expr, span, is_shorthand: _, attrs, id } = f;
|
||||
vis.visit_ident(ident);
|
||||
vis.visit_expr(expr);
|
||||
vis.visit_id(id);
|
||||
vis.visit_span(span);
|
||||
visit_thin_attrs(attrs, vis);
|
||||
}
|
||||
|
@ -1040,8 +1042,12 @@ pub fn noop_visit_pat<T: MutVisitor>(pat: &mut P<Pat>, vis: &mut T) {
|
|||
}
|
||||
PatKind::Struct(path, fields, _etc) => {
|
||||
vis.visit_path(path);
|
||||
for Spanned { node: FieldPat { ident, pat, is_shorthand: _, attrs }, span } in fields {
|
||||
for Spanned {
|
||||
node: FieldPat { ident, pat, is_shorthand: _, attrs, id },
|
||||
span
|
||||
} in fields {
|
||||
vis.visit_ident(ident);
|
||||
vis.visit_id(id);
|
||||
vis.visit_pat(pat);
|
||||
visit_thin_attrs(attrs, vis);
|
||||
vis.visit_span(span);
|
||||
|
|
|
@ -1448,6 +1448,7 @@ impl<'a> Parser<'a> {
|
|||
guard,
|
||||
body: expr,
|
||||
span: lo.to(hi),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1603,6 +1604,7 @@ impl<'a> Parser<'a> {
|
|||
expr: self.mk_expr(self.token.span, ExprKind::Err, ThinVec::new()),
|
||||
is_shorthand: false,
|
||||
attrs: ThinVec::new(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1688,6 +1690,7 @@ impl<'a> Parser<'a> {
|
|||
expr,
|
||||
is_shorthand,
|
||||
attrs: attrs.into(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -665,6 +665,7 @@ impl<'a> Parser<'a> {
|
|||
pat: subpat,
|
||||
is_shorthand,
|
||||
attrs: attrs.into(),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1613,6 +1613,7 @@ impl<'a> TraitDef<'a> {
|
|||
source_map::Spanned {
|
||||
span: pat.span.with_ctxt(self.span.ctxt()),
|
||||
node: ast::FieldPat {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
ident: ident.unwrap(),
|
||||
pat,
|
||||
is_shorthand: false,
|
||||
|
|
Loading…
Add table
Reference in a new issue