// The Rust abstract syntax tree.
-pub use self::AsmDialect::*;
pub use self::AttrStyle::*;
pub use self::BindingMode::*;
pub use self::BinOp_::*;
pub use self::KleeneOp::*;
pub use self::Lit_::*;
pub use self::LitIntType::*;
-pub use self::Mac_::*;
pub use self::MacStmtStyle::*;
pub use self::MetaItem_::*;
pub use self::Mutability::*;
use std::fmt;
use std::rc::Rc;
+use std::borrow::Cow;
use serialize::{Encodable, Decodable, Encoder, Decoder};
// FIXME #6993: in librustc, uses of "ident" should be replaced
impl fmt::Debug for Stmt {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "stmt({}: {})",
- ast_util::stmt_id(self),
+ ast_util::stmt_id(self)
+ .map_or(Cow::Borrowed("<macro>"),|id|Cow::Owned(id.to_string())),
pprust::stmt_to_string(self))
}
}
/// is being invoked, and the vector of token-trees contains the source
/// of the macro invocation.
///
-/// There's only one flavor, now, so this could presumably be simplified.
+/// NB: the additional ident for a macro_rules-style macro is actually
+/// stored in the enclosing item. Oog.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
-pub enum Mac_ {
- // NB: the additional ident for a macro_rules-style macro is actually
- // stored in the enclosing item. Oog.
- MacInvocTT(Path, Vec<TokenTree>, SyntaxContext), // new macro-invocation
+pub struct Mac_ {
+ pub path: Path,
+ pub tts: Vec<TokenTree>,
+ pub ctxt: SyntaxContext,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum AsmDialect {
- AsmAtt,
- AsmIntel
+ Att,
+ Intel,
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub id: NodeId,
/// Explicit discriminant, eg `Foo = 1`
pub disr_expr: Option<P<Expr>>,
- pub vis: Visibility,
}
pub type Variant = Spanned<Variant_>;