about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-06-17 02:27:16 +0000
committerJeffrey Seyfried <jeffrey.seyfried@gmail.com>2016-06-17 05:04:40 +0000
commitb5dbe01a2c7e8ef55fe7a07103dad5c99ace199a (patch)
tree575a7798c96648639aff8c1a3eab1bc84db08ce3 /src/libsyntax
parent114be1e9f0db2c84e38b5ed96d4e4450771e8a44 (diff)
downloadrust-b5dbe01a2c7e8ef55fe7a07103dad5c99ace199a.tar.gz
rust-b5dbe01a2c7e8ef55fe7a07103dad5c99ace199a.zip
Refactor away `ast::Decl` and refactor `ast::Stmt`
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 8537fcc221c..afda1a7eb92 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -786,7 +786,12 @@ impl UnOp {
 }
 
 /// A statement
-pub type Stmt = Spanned<StmtKind>;
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
+pub struct Stmt {
+    pub id: NodeId,
+    pub node: StmtKind,
+    pub span: Span,
+}
 
 impl fmt::Debug for Stmt {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -800,16 +805,19 @@ impl fmt::Debug for Stmt {
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
 pub enum StmtKind {
-    /// Could be an item or a local (let) binding:
-    Decl(P<Decl>, NodeId),
+    /// A local (let) binding:
+    Local(P<Local>),
+
+    /// An item binding
+    Item(P<Item>),
 
     /// Expr without trailing semi-colon (must have unit type):
-    Expr(P<Expr>, NodeId),
+    Expr(P<Expr>),
 
     /// Expr with trailing semi-colon (may have any type):
-    Semi(P<Expr>, NodeId),
+    Semi(P<Expr>),
 
-    Mac(P<Mac>, MacStmtStyle, ThinAttributes),
+    Mac(P<(Mac, MacStmtStyle, ThinAttributes)>),
 }
 
 impl StmtKind {
@@ -860,16 +868,6 @@ impl Local {
     }
 }
 
-pub type Decl = Spanned<DeclKind>;
-
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub enum DeclKind {
-    /// A local (let) binding:
-    Local(P<Local>),
-    /// An item binding:
-    Item(P<Item>),
-}
-
 impl Decl {
     pub fn attrs(&self) -> &[Attribute] {
         HasAttrs::attrs(self)