Fixes #14857.
sp: Span,
tts: &[ast::TokenTree])
-> Box<base::MacResult> {
- let e_attrs = cx.expr_vec_ng(sp);
- let expanded = expand_parse_call(cx, sp, "parse_item",
- vec!(e_attrs), tts);
+ let expanded = expand_parse_call(cx, sp, "parse_item_with_outer_attributes",
+ vec!(), tts);
base::MacExpr::new(expanded)
}
let mut ret = SmallVector::zero();
loop {
let mut parser = self.parser.borrow_mut();
- let attrs = parser.parse_outer_attributes();
- match parser.parse_item(attrs) {
+ match parser.parse_item_with_outer_attributes() {
Some(item) => ret.push(item),
None => break
}
sess: &ParseSess)
-> Option<Gc<ast::Item>> {
let mut p = new_parser_from_source_str(sess, cfg, name, source);
- let attrs = p.parse_outer_attributes();
- maybe_aborted(p.parse_item(attrs),p)
+ maybe_aborted(p.parse_item_with_outer_attributes(),p)
}
pub fn parse_meta_from_source_str(name: String,
return IoviNone(attrs);
}
+ pub fn parse_item_with_outer_attributes(&mut self) -> Option<Gc<Item>> {
+ let attrs = self.parse_outer_attributes();
+ self.parse_item(attrs)
+ }
+
pub fn parse_item(&mut self, attrs: Vec<Attribute> ) -> Option<Gc<Item>> {
match self.parse_item_or_view_item(attrs, true) {
IoviNone(_) => None,
let _f: @syntax::ast::Expr = quote_expr!(cx, ());
let _g: @syntax::ast::Expr = quote_expr!(cx, true);
let _h: @syntax::ast::Expr = quote_expr!(cx, 'a');
+
+ let i: Option<@syntax::ast::Item> = quote_item!(cx, #[deriving(Eq)] struct Foo; );
+ assert!(i.is_some());
}
fn main() {