Skip to content

Commit 5ca9d88

Browse files
committed
---
yaml --- r: 4685 b: refs/heads/master c: f50a582 h: refs/heads/master i: 4683: 3947e5a v: v3
1 parent 86a13af commit 5ca9d88

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: e7139e28f47a7a3c4618925a8ab302d6afc644d6
2+
refs/heads/master: f50a582126e35300bba5a3a8bec001ae6c301ed5

trunk/src/comp/rustc.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ mod middle {
4949

5050
mod syntax {
5151
mod ast;
52+
5253
mod fold;
5354
mod visit;
5455
mod codemap;
@@ -67,6 +68,7 @@ mod syntax {
6768
mod simplext;
6869
mod concat_idents;
6970
mod ident_to_str;
71+
mod log_syntax;
7072
}
7173
mod print {
7274
mod pprust;

trunk/src/comp/syntax/ext/base.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,23 @@ fn syntax_expander_table() -> hashmap[str, syntax_extension] {
2929
normal(ext::concat_idents::expand_syntax_ext));
3030
syntax_expanders.insert("ident_to_str",
3131
normal(ext::ident_to_str::expand_syntax_ext));
32+
syntax_expanders.insert("log_syntax",
33+
normal(ext::log_syntax::expand_syntax_ext));
3234
ret syntax_expanders;
3335
}
3436

35-
obj ext_ctxt(sess: @session, crate_file_name_hack: str,
37+
obj ext_ctxt(sess: @session, crate_file_name_hack: str,
3638
mutable backtrace: span[]) {
3739
fn crate_file_name() -> str { ret crate_file_name_hack; }
3840

41+
fn session() -> @session { ret sess; }
42+
3943
fn print_backtrace() {
4044
for sp: span in backtrace {
4145
sess.span_note(sp, "(while expanding this)")
4246
}
4347
}
44-
48+
4549
fn bt_push(sp: span) { backtrace += ~[sp]; }
4650
fn bt_pop() { ivec::pop(backtrace); }
4751

@@ -59,7 +63,7 @@ obj ext_ctxt(sess: @session, crate_file_name_hack: str,
5963
}
6064
fn span_bug(sp:span, msg: str) -> ! {
6165
self.print_backtrace();
62-
sess.span_bug(sp, msg);
66+
sess.span_bug(sp, msg);
6367
}
6468
fn bug(msg: str) -> ! {
6569
self.print_backtrace();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import std::option;
2+
import base::*;
3+
import syntax::ast;
4+
5+
fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
6+
body: option::t[str]) -> @ast::expr {
7+
8+
cx.print_backtrace();
9+
std::io::stdout().write_line(print::pprust::expr_to_str(arg));
10+
11+
//trivial expression
12+
ret @{id: cx.next_id(), node: ast::expr_rec(~[], option::none), span: sp};
13+
}

0 commit comments

Comments
 (0)