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 pat: P<Pat>,
|
||||||
pub is_shorthand: bool,
|
pub is_shorthand: bool,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
|
@ -925,6 +926,7 @@ pub struct Arm {
|
||||||
pub guard: Option<P<Expr>>,
|
pub guard: Option<P<Expr>>,
|
||||||
pub body: P<Expr>,
|
pub body: P<Expr>,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
|
@ -934,6 +936,7 @@ pub struct Field {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub is_shorthand: bool,
|
pub is_shorthand: bool,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type SpannedIdent = Spanned<Ident>;
|
pub type SpannedIdent = Spanned<Ident>;
|
||||||
|
|
|
@ -403,6 +403,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
span,
|
span,
|
||||||
is_shorthand: false,
|
is_shorthand: false,
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn expr_struct(
|
pub fn expr_struct(
|
||||||
|
@ -612,6 +613,7 @@ impl<'a> ExtCtxt<'a> {
|
||||||
guard: None,
|
guard: None,
|
||||||
body: expr,
|
body: expr,
|
||||||
span,
|
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>(
|
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,
|
vis: &mut T,
|
||||||
) {
|
) {
|
||||||
visit_attrs(attrs, vis);
|
visit_attrs(attrs, vis);
|
||||||
|
vis.visit_id(id);
|
||||||
visit_vec(pats, |pat| vis.visit_pat(pat));
|
visit_vec(pats, |pat| vis.visit_pat(pat));
|
||||||
visit_opt(guard, |guard| vis.visit_expr(guard));
|
visit_opt(guard, |guard| vis.visit_expr(guard));
|
||||||
vis.visit_expr(body);
|
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) {
|
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_ident(ident);
|
||||||
vis.visit_expr(expr);
|
vis.visit_expr(expr);
|
||||||
|
vis.visit_id(id);
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
visit_thin_attrs(attrs, vis);
|
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) => {
|
PatKind::Struct(path, fields, _etc) => {
|
||||||
vis.visit_path(path);
|
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_ident(ident);
|
||||||
|
vis.visit_id(id);
|
||||||
vis.visit_pat(pat);
|
vis.visit_pat(pat);
|
||||||
visit_thin_attrs(attrs, vis);
|
visit_thin_attrs(attrs, vis);
|
||||||
vis.visit_span(span);
|
vis.visit_span(span);
|
||||||
|
|
|
@ -1448,6 +1448,7 @@ impl<'a> Parser<'a> {
|
||||||
guard,
|
guard,
|
||||||
body: expr,
|
body: expr,
|
||||||
span: lo.to(hi),
|
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()),
|
expr: self.mk_expr(self.token.span, ExprKind::Err, ThinVec::new()),
|
||||||
is_shorthand: false,
|
is_shorthand: false,
|
||||||
attrs: ThinVec::new(),
|
attrs: ThinVec::new(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1688,6 +1690,7 @@ impl<'a> Parser<'a> {
|
||||||
expr,
|
expr,
|
||||||
is_shorthand,
|
is_shorthand,
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -665,6 +665,7 @@ impl<'a> Parser<'a> {
|
||||||
pat: subpat,
|
pat: subpat,
|
||||||
is_shorthand,
|
is_shorthand,
|
||||||
attrs: attrs.into(),
|
attrs: attrs.into(),
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1613,6 +1613,7 @@ impl<'a> TraitDef<'a> {
|
||||||
source_map::Spanned {
|
source_map::Spanned {
|
||||||
span: pat.span.with_ctxt(self.span.ctxt()),
|
span: pat.span.with_ctxt(self.span.ctxt()),
|
||||||
node: ast::FieldPat {
|
node: ast::FieldPat {
|
||||||
|
id: ast::DUMMY_NODE_ID,
|
||||||
ident: ident.unwrap(),
|
ident: ident.unwrap(),
|
||||||
pat,
|
pat,
|
||||||
is_shorthand: false,
|
is_shorthand: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue