about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-09-26 17:34:50 +0100
committervarkor <github@varkor.com>2019-09-26 18:21:10 +0100
commit21bf983acbb5d7ac8fb9462cbf2cc4c280abd857 (patch)
treea92c4cc5a421c256847c345f861bee2b074c89ae /src/libsyntax
parentc3d8791373005ef08c876aa649ede245efd2352d (diff)
downloadrust-21bf983acbb5d7ac8fb9462cbf2cc4c280abd857.tar.gz
rust-21bf983acbb5d7ac8fb9462cbf2cc4c280abd857.zip
Rename `Stmt.node` to `Stmt.kind`
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs12
-rw-r--r--src/libsyntax/attr/mod.rs4
-rw-r--r--src/libsyntax/ext/base.rs4
-rw-r--r--src/libsyntax/ext/build.rs10
-rw-r--r--src/libsyntax/ext/expand.rs8
-rw-r--r--src/libsyntax/ext/placeholders.rs4
-rw-r--r--src/libsyntax/mut_visit.rs10
-rw-r--r--src/libsyntax/parse/parser/stmt.rs22
-rw-r--r--src/libsyntax/print/pprust.rs4
-rw-r--r--src/libsyntax/visit.rs2
10 files changed, 40 insertions, 40 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 73751c422f6..684a2f15c62 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -835,31 +835,31 @@ impl UnOp {
 #[derive(Clone, RustcEncodable, RustcDecodable)]
 pub struct Stmt {
     pub id: NodeId,
-    pub node: StmtKind,
+    pub kind: StmtKind,
     pub span: Span,
 }
 
 impl Stmt {
     pub fn add_trailing_semicolon(mut self) -> Self {
-        self.node = match self.node {
+        self.kind = match self.kind {
             StmtKind::Expr(expr) => StmtKind::Semi(expr),
             StmtKind::Mac(mac) => {
                 StmtKind::Mac(mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)))
             }
-            node => node,
+            kind => kind,
         };
         self
     }
 
     pub fn is_item(&self) -> bool {
-        match self.node {
+        match self.kind {
             StmtKind::Item(_) => true,
             _ => false,
         }
     }
 
     pub fn is_expr(&self) -> bool {
-        match self.node {
+        match self.kind {
             StmtKind::Expr(_) => true,
             _ => false,
         }
@@ -991,7 +991,7 @@ impl Expr {
     /// for example, an `if` condition.
     pub fn returns(&self) -> bool {
         if let ExprKind::Block(ref block, _) = self.kind {
-            match block.stmts.last().map(|last_stmt| &last_stmt.node) {
+            match block.stmts.last().map(|last_stmt| &last_stmt.kind) {
                 // Implicit return
                 Some(&StmtKind::Expr(_)) => true,
                 Some(&StmtKind::Semi(ref expr)) => {
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index bba7532df2e..91bd0f29762 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -702,11 +702,11 @@ impl HasAttrs for StmtKind {
 
 impl HasAttrs for Stmt {
     fn attrs(&self) -> &[ast::Attribute] {
-        self.node.attrs()
+        self.kind.attrs()
     }
 
     fn visit_attrs<F: FnOnce(&mut Vec<ast::Attribute>)>(&mut self, f: F) {
-        self.node.visit_attrs(f);
+        self.kind.visit_attrs(f);
     }
 }
 
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index a0093808412..692849eb8cf 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -363,7 +363,7 @@ macro_rules! make_stmts_default {
         $me.make_expr().map(|e| smallvec![ast::Stmt {
             id: ast::DUMMY_NODE_ID,
             span: e.span,
-            node: ast::StmtKind::Expr(e),
+            kind: ast::StmtKind::Expr(e),
         }])
     }
 }
@@ -602,7 +602,7 @@ impl MacResult for DummyResult {
     fn make_stmts(self: Box<DummyResult>) -> Option<SmallVec<[ast::Stmt; 1]>> {
         Some(smallvec![ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)),
+            kind: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)),
             span: self.span,
         }])
     }
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 98b434abea4..a2a7571c440 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -171,7 +171,7 @@ impl<'a> ExtCtxt<'a> {
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
             span: expr.span,
-            node: ast::StmtKind::Expr(expr),
+            kind: ast::StmtKind::Expr(expr),
         }
     }
 
@@ -193,7 +193,7 @@ impl<'a> ExtCtxt<'a> {
         });
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Local(local),
+            kind: ast::StmtKind::Local(local),
             span: sp,
         }
     }
@@ -210,7 +210,7 @@ impl<'a> ExtCtxt<'a> {
         });
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Local(local),
+            kind: ast::StmtKind::Local(local),
             span,
         }
     }
@@ -218,7 +218,7 @@ impl<'a> ExtCtxt<'a> {
     pub fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> ast::Stmt {
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Item(item),
+            kind: ast::StmtKind::Item(item),
             span: sp,
         }
     }
@@ -227,7 +227,7 @@ impl<'a> ExtCtxt<'a> {
         self.block(expr.span, vec![ast::Stmt {
             id: ast::DUMMY_NODE_ID,
             span: expr.span,
-            node: ast::StmtKind::Expr(expr),
+            kind: ast::StmtKind::Expr(expr),
         }])
     }
     pub fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 98a4de4cfe9..d90839ac7fd 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -1206,7 +1206,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
             }
         }
 
-        if let StmtKind::Mac(mac) = stmt.node {
+        if let StmtKind::Mac(mac) = stmt.kind {
             let (mac, style, attrs) = mac.into_inner();
             self.check_attributes(&attrs);
             let mut placeholder = self.collect_bang(mac, stmt.span, AstFragmentKind::Stmts)
@@ -1224,9 +1224,9 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
         }
 
         // The placeholder expander gives ids to statements, so we avoid folding the id here.
-        let ast::Stmt { id, node, span } = stmt;
-        noop_flat_map_stmt_kind(node, self).into_iter().map(|node| {
-            ast::Stmt { id, node, span }
+        let ast::Stmt { id, kind, span } = stmt;
+        noop_flat_map_stmt_kind(kind, self).into_iter().map(|kind| {
+            ast::Stmt { id, kind, span }
         }).collect()
 
     }
diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs
index 05b4985bb73..cb4c685dabe 100644
--- a/src/libsyntax/ext/placeholders.rs
+++ b/src/libsyntax/ext/placeholders.rs
@@ -75,7 +75,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment {
         })),
         AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{
             let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
-            ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) }
+            ast::Stmt { id, span, kind: ast::StmtKind::Mac(mac) }
         }]),
         AstFragmentKind::Arms => AstFragment::Arms(smallvec![
             ast::Arm {
@@ -296,7 +296,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> {
     }
 
     fn flat_map_stmt(&mut self, stmt: ast::Stmt) -> SmallVec<[ast::Stmt; 1]> {
-        let (style, mut stmts) = match stmt.node {
+        let (style, mut stmts) = match stmt.kind {
             ast::StmtKind::Mac(mac) => (mac.1, self.remove(stmt.id).make_stmts()),
             _ => return noop_flat_map_stmt(stmt, self),
         };
diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs
index c08e154e045..0a42fc0cdfd 100644
--- a/src/libsyntax/mut_visit.rs
+++ b/src/libsyntax/mut_visit.rs
@@ -1247,19 +1247,19 @@ pub fn noop_filter_map_expr<T: MutVisitor>(mut e: P<Expr>, vis: &mut T) -> Optio
     Some({ vis.visit_expr(&mut e); e })
 }
 
-pub fn noop_flat_map_stmt<T: MutVisitor>(Stmt { node, mut span, mut id }: Stmt, vis: &mut T)
+pub fn noop_flat_map_stmt<T: MutVisitor>(Stmt { kind, mut span, mut id }: Stmt, vis: &mut T)
     -> SmallVec<[Stmt; 1]>
 {
     vis.visit_id(&mut id);
     vis.visit_span(&mut span);
-    noop_flat_map_stmt_kind(node, vis).into_iter().map(|node| {
-        Stmt { id, node, span }
+    noop_flat_map_stmt_kind(kind, vis).into_iter().map(|kind| {
+        Stmt { id, kind, span }
     }).collect()
 }
 
-pub fn noop_flat_map_stmt_kind<T: MutVisitor>(node: StmtKind, vis: &mut T)
+pub fn noop_flat_map_stmt_kind<T: MutVisitor>(kind: StmtKind, vis: &mut T)
                                               -> SmallVec<[StmtKind; 1]> {
-    match node {
+    match kind {
         StmtKind::Local(mut local) =>
             smallvec![StmtKind::Local({ vis.visit_local(&mut local); local })],
         StmtKind::Item(item) => vis.flat_map_item(item).into_iter().map(StmtKind::Item).collect(),
diff --git a/src/libsyntax/parse/parser/stmt.rs b/src/libsyntax/parse/parser/stmt.rs
index 02da56f6e35..855b03ddd6f 100644
--- a/src/libsyntax/parse/parser/stmt.rs
+++ b/src/libsyntax/parse/parser/stmt.rs
@@ -44,7 +44,7 @@ impl<'a> Parser<'a> {
         Ok(Some(if self.eat_keyword(kw::Let) {
             Stmt {
                 id: DUMMY_NODE_ID,
-                node: StmtKind::Local(self.parse_local(attrs.into())?),
+                kind: StmtKind::Local(self.parse_local(attrs.into())?),
                 span: lo.to(self.prev_span),
             }
         } else if let Some(macro_def) = self.eat_macro_def(
@@ -54,7 +54,7 @@ impl<'a> Parser<'a> {
         )? {
             Stmt {
                 id: DUMMY_NODE_ID,
-                node: StmtKind::Item(macro_def),
+                kind: StmtKind::Item(macro_def),
                 span: lo.to(self.prev_span),
             }
         // Starts like a simple path, being careful to avoid contextual keywords
@@ -86,7 +86,7 @@ impl<'a> Parser<'a> {
 
                 return Ok(Some(Stmt {
                     id: DUMMY_NODE_ID,
-                    node: StmtKind::Expr(expr),
+                    kind: StmtKind::Expr(expr),
                     span: lo.to(self.prev_span),
                 }));
             }
@@ -107,7 +107,7 @@ impl<'a> Parser<'a> {
                 span: lo.to(hi),
                 prior_type_ascription: self.last_type_ascription,
             };
-            let node = if delim == MacDelimiter::Brace ||
+            let kind = if delim == MacDelimiter::Brace ||
                           self.token == token::Semi || self.token == token::Eof {
                 StmtKind::Mac(P((mac, style, attrs.into())))
             }
@@ -137,7 +137,7 @@ impl<'a> Parser<'a> {
             Stmt {
                 id: DUMMY_NODE_ID,
                 span: lo.to(hi),
-                node,
+                kind,
             }
         } else {
             // FIXME: Bad copy of attrs
@@ -150,7 +150,7 @@ impl<'a> Parser<'a> {
                 Some(i) => Stmt {
                     id: DUMMY_NODE_ID,
                     span: lo.to(i.span),
-                    node: StmtKind::Item(i),
+                    kind: StmtKind::Item(i),
                 },
                 None => {
                     let unused_attrs = |attrs: &[Attribute], s: &mut Self| {
@@ -180,7 +180,7 @@ impl<'a> Parser<'a> {
                         return Ok(Some(Stmt {
                             id: DUMMY_NODE_ID,
                             span: lo.to(last_semi),
-                            node: StmtKind::Semi(self.mk_expr(lo.to(last_semi),
+                            kind: StmtKind::Semi(self.mk_expr(lo.to(last_semi),
                                 ExprKind::Tup(Vec::new()),
                                 ThinVec::new()
                             )),
@@ -198,7 +198,7 @@ impl<'a> Parser<'a> {
                     Stmt {
                         id: DUMMY_NODE_ID,
                         span: lo.to(e.span),
-                        node: StmtKind::Expr(e),
+                        kind: StmtKind::Expr(e),
                     }
                 }
             }
@@ -400,7 +400,7 @@ impl<'a> Parser<'a> {
                     self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
                     Some(Stmt {
                         id: DUMMY_NODE_ID,
-                        node: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)),
+                        kind: StmtKind::Expr(DummyResult::raw_expr(self.token.span, true)),
                         span: self.token.span,
                     })
                 }
@@ -431,7 +431,7 @@ impl<'a> Parser<'a> {
             None => return Ok(None),
         };
 
-        match stmt.node {
+        match stmt.kind {
             StmtKind::Expr(ref expr) if self.token != token::Eof => {
                 // expression without semicolon
                 if classify::expr_requires_semi_to_be_stmt(expr) {
@@ -443,7 +443,7 @@ impl<'a> Parser<'a> {
                         self.recover_stmt();
                         // Don't complain about type errors in body tail after parse error (#57383).
                         let sp = expr.span.to(self.prev_span);
-                        stmt.node = StmtKind::Expr(DummyResult::raw_expr(sp, true));
+                        stmt.kind = StmtKind::Expr(DummyResult::raw_expr(sp, true));
                     }
                 }
             }
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 7eaaab9e70d..5bf5842e3f7 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1630,7 +1630,7 @@ impl<'a> State<'a> {
 
     crate fn print_stmt(&mut self, st: &ast::Stmt) {
         self.maybe_print_comment(st.span.lo());
-        match st.node {
+        match st.kind {
             ast::StmtKind::Local(ref loc) => {
                 self.print_outer_attributes(&loc.attrs);
                 self.space_if_not_bol();
@@ -1703,7 +1703,7 @@ impl<'a> State<'a> {
         self.print_inner_attributes(attrs);
 
         for (i, st) in blk.stmts.iter().enumerate() {
-            match st.node {
+            match st.kind {
                 ast::StmtKind::Expr(ref expr) if i == blk.stmts.len() - 1 => {
                     self.maybe_print_comment(st.span.lo());
                     self.space_if_not_bol();
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 16616cf3185..477852e5df1 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -656,7 +656,7 @@ pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) {
 }
 
 pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
-    match statement.node {
+    match statement.kind {
         StmtKind::Local(ref local) => visitor.visit_local(local),
         StmtKind::Item(ref item) => visitor.visit_item(item),
         StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => {