]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/build.rs
Rename `Item.node` to `Item.kind`
[rust.git] / src / libsyntax / ext / build.rs
index 70f915bf8c4db1fd02d38d09b1f50a45bd28ec1d..6b93d045588b9242b62080aecb23cf6fc3704e3d 100644 (file)
@@ -8,9 +8,6 @@
 
 use syntax_pos::{Pos, Span};
 
-// Left so that Cargo tests don't break, this can be removed once those no longer use it
-pub trait AstBuilder {}
-
 impl<'a> ExtCtxt<'a> {
     pub fn path(&self, span: Span, strs: Vec<ast::Ident> ) -> ast::Path {
         self.path_all(span, false, strs, vec![])
@@ -57,11 +54,11 @@ pub fn ty_mt(&self, ty: P<ast::Ty>, mutbl: ast::Mutability) -> ast::MutTy {
         }
     }
 
-    pub fn ty(&self, span: Span, ty: ast::TyKind) -> P<ast::Ty> {
+    pub fn ty(&self, span: Span, kind: ast::TyKind) -> P<ast::Ty> {
         P(ast::Ty {
             id: ast::DUMMY_NODE_ID,
             span,
-            node: ty
+            kind,
         })
     }
 
@@ -76,12 +73,12 @@ pub fn ty_ident(&self, span: Span, ident: ast::Ident)
         self.ty_path(self.path_ident(span, ident))
     }
 
-    pub fn anon_const(&self, span: Span, expr: ast::ExprKind) -> ast::AnonConst {
+    pub fn anon_const(&self, span: Span, kind: ast::ExprKind) -> ast::AnonConst {
         ast::AnonConst {
             id: ast::DUMMY_NODE_ID,
             value: P(ast::Expr {
                 id: ast::DUMMY_NODE_ID,
-                node: expr,
+                kind,
                 span,
                 attrs: ThinVec::new(),
             })
@@ -111,10 +108,6 @@ pub fn ty_ptr(&self,
                 ast::TyKind::Ptr(self.ty_mt(ty, mutbl)))
     }
 
-    pub fn ty_infer(&self, span: Span) -> P<ast::Ty> {
-        self.ty(span, ast::TyKind::Infer)
-    }
-
     pub fn typaram(&self,
                span: Span,
                ident: ast::Ident,
@@ -178,7 +171,7 @@ pub fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt {
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
             span: expr.span,
-            node: ast::StmtKind::Expr(expr),
+            kind: ast::StmtKind::Expr(expr),
         }
     }
 
@@ -200,7 +193,7 @@ pub fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident,
         });
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Local(local),
+            kind: ast::StmtKind::Local(local),
             span: sp,
         }
     }
@@ -217,7 +210,7 @@ pub fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt {
         });
         ast::Stmt {
             id: ast::DUMMY_NODE_ID,
-            node: ast::StmtKind::Local(local),
+            kind: ast::StmtKind::Local(local),
             span,
         }
     }
@@ -225,7 +218,7 @@ pub fn stmt_let_type_only(&self, span: Span, ty: P<ast::Ty>) -> ast::Stmt {
     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,
         }
     }
@@ -234,7 +227,7 @@ pub fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block> {
         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> {
@@ -246,10 +239,10 @@ pub fn block(&self, span: Span, stmts: Vec<ast::Stmt>) -> P<ast::Block> {
         })
     }
 
-    pub fn expr(&self, span: Span, node: ast::ExprKind) -> P<ast::Expr> {
+    pub fn expr(&self, span: Span, kind: ast::ExprKind) -> P<ast::Expr> {
         P(ast::Expr {
             id: ast::DUMMY_NODE_ID,
-            node,
+            kind,
             span,
             attrs: ThinVec::new(),
         })
@@ -418,8 +411,8 @@ pub fn expr_try(&self, sp: Span, head: P<ast::Expr>) -> P<ast::Expr> {
     }
 
 
-    pub fn pat(&self, span: Span, pat: PatKind) -> P<ast::Pat> {
-        P(ast::Pat { id: ast::DUMMY_NODE_ID, node: pat, span })
+    pub fn pat(&self, span: Span, kind: PatKind) -> P<ast::Pat> {
+        P(ast::Pat { id: ast::DUMMY_NODE_ID, kind, span })
     }
     pub fn pat_wild(&self, span: Span) -> P<ast::Pat> {
         self.pat(span, PatKind::Wild)
@@ -524,7 +517,7 @@ pub fn lambda(&self,
               body: P<ast::Expr>)
               -> P<ast::Expr> {
         let fn_decl = self.fn_decl(
-            ids.iter().map(|id| self.param(span, *id, self.ty_infer(span))).collect(),
+            ids.iter().map(|id| self.param(span, *id, self.ty(span, ast::TyKind::Infer))).collect(),
             ast::FunctionRetTy::Default(span));
 
         // FIXME -- We are using `span` as the span of the `|...|`
@@ -574,14 +567,14 @@ pub fn fn_decl(&self, inputs: Vec<ast::Param>, output: ast::FunctionRetTy) -> P<
     }
 
     pub fn item(&self, span: Span, name: Ident,
-            attrs: Vec<ast::Attribute>, node: ast::ItemKind) -> P<ast::Item> {
+            attrs: Vec<ast::Attribute>, kind: ast::ItemKind) -> P<ast::Item> {
         // FIXME: Would be nice if our generated code didn't violate
         // Rust coding conventions
         P(ast::Item {
             ident: name,
             attrs,
             id: ast::DUMMY_NODE_ID,
-            node,
+            kind,
             vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
             span,
             tokens: None,
@@ -644,18 +637,4 @@ pub fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute {
     pub fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {
         attr::mk_word_item(Ident::new(w, sp))
     }
-
-    pub fn meta_list_item_word(&self, sp: Span, w: ast::Name) -> ast::NestedMetaItem {
-        attr::mk_nested_word_item(Ident::new(w, sp))
-    }
-
-    pub fn meta_list(&self, sp: Span, name: ast::Name, mis: Vec<ast::NestedMetaItem>)
-                 -> ast::MetaItem {
-        attr::mk_list_item(Ident::new(name, sp), mis)
-    }
-
-    pub fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
-                       -> ast::MetaItem {
-        attr::mk_name_value_item(Ident::new(name, span), lit_kind, span)
-    }
 }