about summary refs log tree commit diff
path: root/src/comp/syntax/ext
diff options
context:
space:
mode:
authorKevin Atkinson <kevina@cs.utah.edu>2012-02-01 03:37:53 -0700
committerKevin Atkinson <kevina@cs.utah.edu>2012-02-03 20:41:49 -0700
commit9090a5c03b3ebcaee98de53ddf13f3204ff9c5f9 (patch)
tree00cc509567fc86595e1c8d00f80957efa20fe325 /src/comp/syntax/ext
parent4d71285c933586f92497a5b5fb85368fd130f4e6 (diff)
Store info about file "substr".
That is when a string that is part of a file needs to be parsed for a
reason, record that the string is a substr of the file rather than
using "<anon>" or "-" as the file name.  This will eventually allow
pointing to the right location, for now it just uses a more
meaningful string for the filename.
Diffstat (limited to 'src/comp/syntax/ext')
-rw-r--r--src/comp/syntax/ext/qquote.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/comp/syntax/ext/qquote.rs b/src/comp/syntax/ext/qquote.rs
index 2e2d9f7481e..d43011663b7 100644
--- a/src/comp/syntax/ext/qquote.rs
+++ b/src/comp/syntax/ext/qquote.rs
@@ -48,8 +48,10 @@ fn expand_ast(ecx: ext_ctxt, _sp: span, _arg: ast::mac_arg, body: ast::mac_body)
 {
     let body = get_mac_body(ecx,_sp,body);
     let str = @codemap::span_to_snippet(body.span, ecx.session().parse_sess.cm);
+    let (fname, ss) = codemap::get_substr_info(ecx.session().parse_sess.cm, 
+                                               body.span.lo, body.span.hi);
     let {node: e, _} = parse_from_source_str(parser::parse_expr, 
-                                             "<anon>", str, 
+                                             fname, some(ss), str, 
                                              ecx.session().opts.cfg, 
                                              ecx.session().parse_sess);
     ret expand_qquote(ecx, e.span, some(*str), e);