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; +#[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, NodeId), + /// A local (let) binding: + Local(P), + + /// An item binding + Item(P), /// Expr without trailing semi-colon (must have unit type): - Expr(P, NodeId), + Expr(P), /// Expr with trailing semi-colon (may have any type): - Semi(P, NodeId), + Semi(P), - Mac(P, MacStmtStyle, ThinAttributes), + Mac(P<(Mac, MacStmtStyle, ThinAttributes)>), } impl StmtKind { @@ -860,16 +868,6 @@ impl Local { } } -pub type Decl = Spanned; - -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] -pub enum DeclKind { - /// A local (let) binding: - Local(P), - /// An item binding: - Item(P), -} - impl Decl { pub fn attrs(&self) -> &[Attribute] { HasAttrs::attrs(self)