Skip to content

Commit 4b566fe

Browse files
committed
rustc: Hide the parser from syntax extensions
Eventually extensions will probably need access to the parser again, but it'll be in a different form.
1 parent c88fa92 commit 4b566fe

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/comp/front/ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import front::parser::parser;
66
import util::common::span;
77
import util::common::new_str_hash;
88

9-
type syntax_expander = fn(&ext_ctxt, &parser::parser, span,
9+
type syntax_expander = fn(&ext_ctxt, span,
1010
&vec[@ast::expr],
1111
option::t[str]) -> @ast::expr;
1212

src/comp/front/extenv.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ import ext::*;
1515

1616
export expand_syntax_ext;
1717

18-
1918
fn expand_syntax_ext(&ext_ctxt cx,
20-
&parser::parser p,
2119
common::span sp,
2220
&vec[@ast::expr] args,
2321
option::t[str] body) -> @ast::expr {

src/comp/front/extfmt.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* compiler syntax extension plugin interface.
55
*/
66

7-
import front::parser::parser;
87
import util::common;
98

109
import std::str;
@@ -20,7 +19,7 @@ import ext::*;
2019
export expand_syntax_ext;
2120

2221
fn expand_syntax_ext(&ext_ctxt cx,
23-
&parser p, common::span sp,
22+
common::span sp,
2423
&vec[@ast::expr] args,
2524
option::t[str] body) -> @ast::expr {
2625

@@ -36,7 +35,7 @@ fn expand_syntax_ext(&ext_ctxt cx,
3635
auto pieces = parse_fmt_string(fmt);
3736
auto args_len = vec::len[@ast::expr](args);
3837
auto fmt_args = vec::slice[@ast::expr](args, 1u, args_len - 1u);
39-
ret pieces_to_expr(cx, p, sp, pieces, args);
38+
ret pieces_to_expr(cx, sp, pieces, args);
4039
}
4140

4241
fn expr_to_str(&ext_ctxt cx, @ast::expr expr) -> str {
@@ -60,9 +59,8 @@ fn expr_to_str(&ext_ctxt cx, @ast::expr expr) -> str {
6059

6160
// FIXME: A lot of these functions for producing expressions can probably
6261
// be factored out in common with other code that builds expressions.
63-
// FIXME: Probably should be using the parser's span functions
6462
// FIXME: Cleanup the naming of these functions
65-
fn pieces_to_expr(&ext_ctxt cx, parser p, common::span sp,
63+
fn pieces_to_expr(&ext_ctxt cx, common::span sp,
6664
vec[piece] pieces, vec[@ast::expr] args) -> @ast::expr {
6765

6866
fn make_new_lit(&ext_ctxt cx,

src/comp/front/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ fn expand_syntax_ext(&parser p, common::span sp,
10501050
case (some(ext::x(?ext))) {
10511051
auto ext_cx = ext::mk_ctxt(p);
10521052
ret ast::expr_ext(path, args, body,
1053-
ext(ext_cx, p, sp, args, body),
1053+
ext(ext_cx, sp, args, body),
10541054
p.get_ann());
10551055
}
10561056
}

0 commit comments

Comments
 (0)