1
Fork 0

syntax: print expansion info from #[attribute] macros in the correct

format.

Previously, any attempt to use this information from inside something
like #[deriving(Foo)] would result in it printing like `deriving(Foo)!`.
This commit is contained in:
Huon Wilson 2013-12-07 13:41:11 +11:00
parent 09a879460c
commit 3ef933647a
4 changed files with 29 additions and 4 deletions

View file

@ -161,8 +161,22 @@ pub struct LocWithOpt {
// used to be structural records. Better names, anyone?
pub struct FileMapAndLine {fm: @FileMap, line: uint}
pub struct FileMapAndBytePos {fm: @FileMap, pos: BytePos}
#[deriving(IterBytes)]
pub struct NameAndSpan {name: @str, span: Option<Span>}
pub enum MacroFormat {
// e.g. #[deriving(...)] <item>
MacroAttribute,
// e.g. `format!()`
MacroBang
}
#[deriving(IterBytes)]
pub struct NameAndSpan {
name: @str,
// the format with which the macro was invoked.
format: MacroFormat,
span: Option<Span>
}
/// Extra information for tracking macro expansion of spans
#[deriving(IterBytes)]