diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 11:56:00 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-21 11:56:00 -0800 |
| commit | df1cddf20a2a4ece854e5d8592ad3155a3313fd2 (patch) | |
| tree | 50bdd6498e1378cbeb48e80e35157152920e9c56 /src/libsyntax/ast.rs | |
| parent | 886c6f3534e6f03916eeff2ea8b235e85dd04b42 (diff) | |
| parent | 2d17a33878f1af0aa500a4e1ff6aa5c8689ab249 (diff) | |
| download | rust-df1cddf20a2a4ece854e5d8592ad3155a3313fd2.tar.gz rust-df1cddf20a2a4ece854e5d8592ad3155a3313fd2.zip | |
rollup merge of #20179: eddyb/blind-items
Conflicts: src/librustc/diagnostics.rs src/librustdoc/clean/mod.rs src/librustdoc/html/format.rs src/libsyntax/parse/parser.rs
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 49 |
1 files changed, 11 insertions, 38 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index acc5c70ac3c..7111fe3af1f 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -53,7 +53,6 @@ pub use self::UnboxedClosureKind::*; pub use self::UnOp::*; pub use self::UnsafeSource::*; pub use self::VariantKind::*; -pub use self::ViewItem_::*; pub use self::ViewPath_::*; pub use self::Visibility::*; pub use self::PathParameters::*; @@ -511,7 +510,6 @@ impl PartialEq for MetaItem_ { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] pub struct Block { - pub view_items: Vec<ViewItem>, pub stmts: Vec<P<Stmt>>, pub expr: Option<P<Expr>>, pub id: NodeId, @@ -1443,14 +1441,12 @@ pub struct Mod { /// For `mod foo;`, the inner span ranges from the first token /// to the last token in the external file. pub inner: Span, - pub view_items: Vec<ViewItem>, pub items: Vec<P<Item>>, } #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] pub struct ForeignMod { pub abi: Abi, - pub view_items: Vec<ViewItem>, pub items: Vec<P<ForeignItem>>, } @@ -1509,44 +1505,13 @@ pub enum ViewPath_ { /// or just /// /// `foo::bar::baz` (with `as baz` implicitly on the right) - ViewPathSimple(Ident, Path, NodeId), + ViewPathSimple(Ident, Path), /// `foo::bar::*` - ViewPathGlob(Path, NodeId), + ViewPathGlob(Path), /// `foo::bar::{a,b,c}` - ViewPathList(Path, Vec<PathListItem> , NodeId) -} - -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] -pub struct ViewItem { - pub node: ViewItem_, - pub attrs: Vec<Attribute>, - pub vis: Visibility, - pub span: Span, -} - -impl ViewItem { - pub fn id(&self) -> NodeId { - match self.node { - ViewItemExternCrate(_, _, id) => id, - ViewItemUse(ref vp) => match vp.node { - ViewPathSimple(_, _, id) => id, - ViewPathGlob(_, id) => id, - ViewPathList(_, _, id) => id, - } - } - } -} - -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] -pub enum ViewItem_ { - /// Ident: name used to refer to this crate in the code - /// optional (InternedString,StrStyle): if present, this is a location - /// (containing arbitrary characters) from which to fetch the crate sources - /// For example, extern crate whatever = "github.com/rust-lang/rust" - ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId), - ViewItemUse(P<ViewPath>), + ViewPathList(Path, Vec<PathListItem>) } /// Meta-data associated with an item @@ -1668,6 +1633,12 @@ pub struct Item { #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)] pub enum Item_ { + // Optional location (containing arbitrary characters) from which + // to fetch the crate sources. + // For example, extern crate whatever = "github.com/rust-lang/rust". + ItemExternCrate(Option<(InternedString, StrStyle)>), + ItemUse(P<ViewPath>), + ItemStatic(P<Ty>, Mutability, P<Expr>), ItemConst(P<Ty>, P<Expr>), ItemFn(P<FnDecl>, Unsafety, Abi, Generics, P<Block>), @@ -1694,6 +1665,8 @@ pub enum Item_ { impl Item_ { pub fn descriptive_variant(&self) -> &str { match *self { + ItemExternCrate(..) => "extern crate", + ItemUse(..) => "use", ItemStatic(..) => "static item", ItemConst(..) => "constant item", ItemFn(..) => "function", |
