Skip to content

Commit c0f9073

Browse files
committed
Expand result of quasi-quote.
1 parent 67e961c commit c0f9073

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/comp/syntax/ext/expand.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ fn expand_expr(exts: hashmap<str, syntax_extension>, cx: ext_ctxt,
4646
}
4747
}
4848
}
49-
mac_qq(sp, exp) { (expand_qquote(cx, sp, exp), s) }
49+
mac_qq(sp, exp) {
50+
let r = expand_qquote(cx, sp, exp);
51+
// need to keep going, resuls may contain embedded qquote or
52+
// macro that need expanding
53+
let r2 = fld.fold_expr(r);
54+
(r2.node, s)
55+
}
5056
_ { cx.span_bug(mac.span, "naked syntactic bit") }
5157
}
5258
}

src/comp/syntax/ext/qquote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn visit_expr_aq(expr: @ast::expr, &&cx: aq_ctxt, v: vt<aq_ctxt>)
3838
}
3939
}
4040

41-
fn expand_qquote(ecx: ext_ctxt, sp: span, e: @ast::expr) -> ast::expr_ {
41+
fn expand_qquote(ecx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
4242
let str = codemap::span_to_snippet(sp, ecx.session().parse_sess.cm);
4343
let qcx = gather_anti_quotes(sp.lo, e);
4444
let cx = qcx;
@@ -89,7 +89,7 @@ fn expand_qquote(ecx: ext_ctxt, sp: span, e: @ast::expr) -> ast::expr_ {
8989
mk_vec_e(cx,sp, vec::map(qcx.gather, {|g| g.e}))]);
9090
}
9191

92-
ret rcall.node;
92+
ret rcall;
9393
}
9494

9595
fn replace(e: @ast::expr, repls: [@ast::expr]) -> @ast::expr {

0 commit comments

Comments
 (0)