Skip to content

Commit ffe88d5

Browse files
huonwalexcrichton
authored andcommitted
---
yaml --- r: 152504 b: refs/heads/try2 c: f907d97 h: refs/heads/master v: v3
1 parent bf98088 commit ffe88d5

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 9d5ec04d184a5d28e75d74b725ebb7cc21b547af
8+
refs/heads/try2: f907d9772c55d942fb178622b0b2b5a8ca103c11
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libsyntax/ext/quote.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,8 @@ pub fn expand_quote_item(cx: &mut ExtCtxt,
358358
sp: Span,
359359
tts: &[ast::TokenTree])
360360
-> Box<base::MacResult> {
361-
let e_attrs = cx.expr_vec_ng(sp);
362-
let expanded = expand_parse_call(cx, sp, "parse_item",
363-
vec!(e_attrs), tts);
361+
let expanded = expand_parse_call(cx, sp, "parse_item_with_outer_attributes",
362+
vec!(), tts);
364363
base::MacExpr::new(expanded)
365364
}
366365

branches/try2/src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ impl<'a> MacResult for ParserAnyMacro<'a> {
7373
let mut ret = SmallVector::zero();
7474
loop {
7575
let mut parser = self.parser.borrow_mut();
76-
let attrs = parser.parse_outer_attributes();
77-
match parser.parse_item(attrs) {
76+
match parser.parse_item_with_outer_attributes() {
7877
Some(item) => ret.push(item),
7978
None => break
8079
}

branches/try2/src/libsyntax/parse/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ pub fn parse_item_from_source_str(name: String,
117117
sess: &ParseSess)
118118
-> Option<Gc<ast::Item>> {
119119
let mut p = new_parser_from_source_str(sess, cfg, name, source);
120-
let attrs = p.parse_outer_attributes();
121-
maybe_aborted(p.parse_item(attrs),p)
120+
maybe_aborted(p.parse_item_with_outer_attributes(),p)
122121
}
123122

124123
pub fn parse_meta_from_source_str(name: String,

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,6 +4965,11 @@ impl<'a> Parser<'a> {
49654965
return IoviNone(attrs);
49664966
}
49674967

4968+
pub fn parse_item_with_outer_attributes(&mut self) -> Option<Gc<Item>> {
4969+
let attrs = self.parse_outer_attributes();
4970+
self.parse_item(attrs)
4971+
}
4972+
49684973
pub fn parse_item(&mut self, attrs: Vec<Attribute> ) -> Option<Gc<Item>> {
49694974
match self.parse_item_or_view_item(attrs, true) {
49704975
IoviNone(_) => None,

branches/try2/src/test/run-pass-fulldeps/quote-tokens.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ fn syntax_extension(cx: &ExtCtxt) {
2828
let _f: @syntax::ast::Expr = quote_expr!(cx, ());
2929
let _g: @syntax::ast::Expr = quote_expr!(cx, true);
3030
let _h: @syntax::ast::Expr = quote_expr!(cx, 'a');
31+
32+
let i: Option<@syntax::ast::Item> = quote_item!(cx, #[deriving(Eq)] struct Foo; );
33+
assert!(i.is_some());
3134
}
3235

3336
fn main() {

0 commit comments

Comments
 (0)