diff options
| author | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-18 00:56:56 +0200 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-20 12:40:08 +0200 |
| commit | 4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4 (patch) | |
| tree | ada16b620d93f1ae709185df0986c58a62614e8d /src/libsyntax/ast.rs | |
| parent | 50481f55030f02543e1b3b6ae008d77b1cef3e98 (diff) | |
| download | rust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.tar.gz rust-4b9bc2e8f268dfe2a2462c4e378e5a0eeefa2cf4.zip | |
Implement new mod import sugar
Implements RFC #168.
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 394d4a82516..7ad9a18a15e 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1033,12 +1033,20 @@ pub struct Variant_ { pub type Variant = Spanned<Variant_>; #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] -pub struct PathListIdent_ { - pub name: Ident, - pub id: NodeId, +pub enum PathListItem_ { + PathListIdent { pub name: Ident, pub id: NodeId }, + PathListMod { pub id: NodeId } +} + +impl PathListItem_ { + pub fn id(&self) -> NodeId { + match *self { + PathListIdent { id, .. } | PathListMod { id } => id + } + } } -pub type PathListIdent = Spanned<PathListIdent_>; +pub type PathListItem = Spanned<PathListItem_>; pub type ViewPath = Spanned<ViewPath_>; @@ -1056,7 +1064,7 @@ pub enum ViewPath_ { ViewPathGlob(Path, NodeId), /// `foo::bar::{a,b,c}` - ViewPathList(Path, Vec<PathListIdent> , NodeId) + ViewPathList(Path, Vec<PathListItem> , NodeId) } #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] |
