diff options
| author | Oliver 'ker' Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-09 11:36:51 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | 019614f03d106324ab50a37746b556c41e66c099 (patch) | |
| tree | e95206fa5d2ee8c83a9915f03bcefc32081fc7bb /src/libsyntax/ext | |
| parent | 0d6ddd190355650a6d851c3aae12cf79339665af (diff) | |
[breaking-change] don't glob export ast::Item_ variants
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 24 |
3 files changed, 23 insertions, 23 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index ceb7cf69680..381d952ea88 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -120,7 +120,7 @@ impl<F> MultiItemDecorator for F } } -// A more flexible ItemModifier (ItemModifier should go away, eventually, FIXME). +// A more flexible ItemKind::Modifier (ItemKind::Modifier should go away, eventually, FIXME). // meta_item is the annotation, item is the item being modified, parent_item // is the impl or trait item is declared in if item is part of such a thing. // FIXME Decorators should follow the same pattern too. diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 76071cc71e6..256825eacf2 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -213,7 +213,7 @@ pub trait AstBuilder { // items fn item(&self, span: Span, - name: Ident, attrs: Vec<ast::Attribute> , node: ast::Item_) -> P<ast::Item>; + name: Ident, attrs: Vec<ast::Attribute> , node: ast::ItemKind) -> P<ast::Item>; fn arg(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> ast::Arg; // FIXME unused self @@ -951,7 +951,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn item(&self, span: Span, name: Ident, - attrs: Vec<ast::Attribute>, node: ast::Item_) -> P<ast::Item> { + attrs: Vec<ast::Attribute>, node: ast::ItemKind) -> P<ast::Item> { // FIXME: Would be nice if our generated code didn't violate // Rust coding conventions P(ast::Item { @@ -974,7 +974,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.item(span, name, Vec::new(), - ast::ItemFn(self.fn_decl(inputs, output), + ast::ItemKind::Fn(self.fn_decl(inputs, output), ast::Unsafety::Normal, ast::Constness::NotConst, Abi::Rust, @@ -1026,7 +1026,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn item_enum_poly(&self, span: Span, name: Ident, enum_definition: ast::EnumDef, generics: Generics) -> P<ast::Item> { - self.item(span, name, Vec::new(), ast::ItemEnum(enum_definition, generics)) + self.item(span, name, Vec::new(), ast::ItemKind::Enum(enum_definition, generics)) } fn item_enum(&self, span: Span, name: Ident, @@ -1047,7 +1047,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn item_struct_poly(&self, span: Span, name: Ident, struct_def: ast::VariantData, generics: Generics) -> P<ast::Item> { - self.item(span, name, Vec::new(), ast::ItemStruct(struct_def, generics)) + self.item(span, name, Vec::new(), ast::ItemKind::Struct(struct_def, generics)) } fn item_mod(&self, span: Span, inner_span: Span, name: Ident, @@ -1057,7 +1057,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { span, name, attrs, - ast::ItemMod(ast::Mod { + ast::ItemKind::Mod(ast::Mod { inner: inner_span, items: items, }) @@ -1071,7 +1071,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { mutbl: ast::Mutability, expr: P<ast::Expr>) -> P<ast::Item> { - self.item(span, name, Vec::new(), ast::ItemStatic(ty, mutbl, expr)) + self.item(span, name, Vec::new(), ast::ItemKind::Static(ty, mutbl, expr)) } fn item_const(&self, @@ -1080,12 +1080,12 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ty: P<ast::Ty>, expr: P<ast::Expr>) -> P<ast::Item> { - self.item(span, name, Vec::new(), ast::ItemConst(ty, expr)) + self.item(span, name, Vec::new(), ast::ItemKind::Const(ty, expr)) } fn item_ty_poly(&self, span: Span, name: Ident, ty: P<ast::Ty>, generics: Generics) -> P<ast::Item> { - self.item(span, name, Vec::new(), ast::ItemTy(ty, generics)) + self.item(span, name, Vec::new(), ast::ItemKind::Ty(ty, generics)) } fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item> { @@ -1125,7 +1125,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, ident: special_idents::invalid, attrs: vec![], - node: ast::ItemUse(vp), + node: ast::ItemKind::Use(vp), vis: vis, span: sp }) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 78bc4e2c735..bcd02fb8cb3 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -10,7 +10,7 @@ use ast::{Block, Crate, DeclKind, PatMac}; use ast::{Local, Ident, Mac_, Name}; -use ast::{ItemMac, MacStmtWithSemicolon, Mrk, Stmt, StmtKind}; +use ast::{MacStmtStyle, Mrk, Stmt, StmtKind, ItemKind}; use ast::TokenTree; use ast; use ext::mtwt; @@ -315,17 +315,17 @@ pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander) .into_iter().map(|i| i.expect_item()).collect() } -/// Expand item_underscore -fn expand_item_underscore(item: ast::Item_, fld: &mut MacroExpander) -> ast::Item_ { +/// Expand item_kind +fn expand_item_kind(item: ast::ItemKind, fld: &mut MacroExpander) -> ast::ItemKind { match item { - ast::ItemFn(decl, unsafety, constness, abi, generics, body) => { + ast::ItemKind::Fn(decl, unsafety, constness, abi, generics, body) => { let (rewritten_fn_decl, rewritten_body) = expand_and_rename_fn_decl_and_block(decl, body, fld); let expanded_generics = fold::noop_fold_generics(generics,fld); - ast::ItemFn(rewritten_fn_decl, unsafety, constness, abi, + ast::ItemKind::Fn(rewritten_fn_decl, unsafety, constness, abi, expanded_generics, rewritten_body) } - _ => noop_fold_item_underscore(item, fld) + _ => noop_fold_item_kind(item, fld) } } @@ -362,7 +362,7 @@ fn contains_macro_use(fld: &mut MacroExpander, attrs: &[ast::Attribute]) -> bool pub fn expand_item_mac(it: P<ast::Item>, fld: &mut MacroExpander) -> SmallVector<P<ast::Item>> { let (extname, path_span, tts, span, attrs, ident) = it.and_then(|it| match it.node { - ItemMac(codemap::Spanned { node: Mac_ { path, tts, .. }, .. }) => + ItemKind::Mac(codemap::Spanned { node: Mac_ { path, tts, .. }, .. }) => (path.segments[0].identifier.name, path.span, tts, it.span, it.attrs, it.ident), _ => fld.cx.span_bug(it.span, "invalid item macro invocation") }); @@ -890,10 +890,10 @@ fn expand_annotatable(a: Annotatable, let mut new_items: SmallVector<Annotatable> = match a { Annotatable::Item(it) => match it.node { - ast::ItemMac(..) => { + ast::ItemKind::Mac(..) => { expand_item_mac(it, fld).into_iter().map(|i| Annotatable::Item(i)).collect() } - ast::ItemMod(_) | ast::ItemForeignMod(_) => { + ast::ItemKind::Mod(_) | ast::ItemKind::ForeignMod(_) => { let valid_ident = it.ident.name != parse::token::special_idents::invalid.name; @@ -1048,7 +1048,7 @@ fn expand_item_multi_modifier(mut it: Annotatable, } } - // Expansion may have added new ItemModifiers. + // Expansion may have added new ItemKind::Modifiers. expand_item_multi_modifier(it, fld) } @@ -1194,8 +1194,8 @@ impl<'a, 'b> Folder for MacroExpander<'a, 'b> { expand_item(item, self) } - fn fold_item_underscore(&mut self, item: ast::Item_) -> ast::Item_ { - expand_item_underscore(item, self) + fn fold_item_kind(&mut self, item: ast::ItemKind) -> ast::ItemKind { + expand_item_kind(item, self) } fn fold_stmt(&mut self, stmt: P<ast::Stmt>) -> SmallVector<P<ast::Stmt>> { |
