diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-07 13:41:11 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-12-07 13:41:11 +1100 |
| commit | 3ef933647ab6adf841d8323a712101f37851eff9 (patch) | |
| tree | 545ae6c4fbd16b29189abb7bee7ef259a92b50b6 /src/libsyntax/codemap.rs | |
| parent | 09a879460cfa42ecfd4a769bdc21e1d55b795bd8 (diff) | |
| download | rust-3ef933647ab6adf841d8323a712101f37851eff9.tar.gz rust-3ef933647ab6adf841d8323a712101f37851eff9.zip | |
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)!`.
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index f7590e7b4ed..f4cb19bfa24 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -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)] |
