Skip to content

Commit 9f27bf7

Browse files
committed
syntax: fix the accidental binding of interner state between parse and quote.
1 parent 65db431 commit 9f27bf7

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/libsyntax/ext/quote.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use token::*;
1919
*
2020
* Quasiquoting works via token trees.
2121
*
22-
* This is registered as a expression syntax extension called quote! that lifts
22+
* This is registered as a set of expression syntax extension called quote! that lifts
2323
* its argument token-tree to an AST representing the construction of the same
2424
* token tree, with ast::tt_nonterminal nodes interpreted as antiquotes
2525
* (splices).
@@ -146,16 +146,12 @@ fn mk_span(cx: ext_ctxt, qsp: span, sp: span) -> @ast::expr {
146146
}
147147

148148
// Lift an ident to the expr that evaluates to that ident.
149-
//
150-
// NB: this identifies the interner used when re-parsing the token tree
151-
// with the interner used during initial parse. This is _wrong_ and we
152-
// should be emitting a &str here and the token type should be ok with
153-
// &static/str or &session/str. Longer-term issue.
154149
fn mk_ident(cx: ext_ctxt, sp: span, ident: ast::ident) -> @ast::expr {
155-
build::mk_struct_e(cx, sp,
156-
ids_ext(cx, ~[~"ident"]),
157-
~[{ident: id_ext(cx, ~"repr"),
158-
ex: build::mk_uint(cx, sp, ident.repr) }])
150+
let e_meth = build::mk_access(cx, sp,
151+
ids_ext(cx, ~[~"ext_cx"]),
152+
id_ext(cx, ~"ident_of"));
153+
let e_str = build::mk_uniq_str(cx, sp, cx.str_of(ident));
154+
build::mk_call_(cx, sp, e_meth, ~[e_str])
159155
}
160156

161157
fn mk_bytepos(cx: ext_ctxt, sp: span, bpos: BytePos) -> @ast::expr {

0 commit comments

Comments
 (0)