aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-02-27 22:35:27 -0500
committerGraydon Hoare <[email protected]>2011-03-02 10:28:15 -0800
commitc1e6f5328c3f46884ed7a7e29c780e307b02100a (patch)
tree10ed869d28e3a9a4eb4a343151d6b1af7791b8d6 /src
parentAdd pretty printing for expr_call, expr_path, and more literals (diff)
downloadrust-c1e6f5328c3f46884ed7a7e29c780e307b02100a.tar.xz
rust-c1e6f5328c3f46884ed7a7e29c780e307b02100a.zip
Make the expanded expression in expr_ext not optional
Diffstat (limited to 'src')
-rw-r--r--src/comp/front/ast.rs2
-rw-r--r--src/comp/front/parser.rs2
-rw-r--r--src/comp/middle/fold.rs9
-rw-r--r--src/comp/middle/trans.rs2
-rw-r--r--src/comp/middle/typeck.rs5
5 files changed, 9 insertions, 11 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 18add3bd..694a709d 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -185,7 +185,7 @@ tag expr_ {
expr_field(@expr, ident, ann);
expr_index(@expr, @expr, ann);
expr_path(path, option.t[def], ann);
- expr_ext(path, vec[@expr], option.t[@expr], option.t[@expr], ann);
+ expr_ext(path, vec[@expr], option.t[@expr], @expr, ann);
expr_fail;
expr_ret(option.t[@expr]);
expr_put(option.t[@expr]);
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 7a7a863c..5fe16536 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -755,7 +755,7 @@ impure fn expand_syntax_ext(parser p, ast.span sp,
if (_str.eq(extname, "fmt")) {
auto expanded = extfmt.expand_syntax_ext(args, body);
auto newexpr = ast.expr_ext(path, args, body,
- some[@ast.expr](expanded),
+ expanded,
ast.ann_none);
ret newexpr;
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index d533082c..c7041b26 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -157,7 +157,7 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp,
&path p, vec[@expr] args,
option.t[@expr] body,
- option.t[@expr] expanded,
+ @expr expanded,
ann a) -> @expr) fold_expr_ext,
(fn(&ENV e, &span sp) -> @expr) fold_expr_fail,
@@ -653,10 +653,9 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
case (ast.expr_ext(?p, ?args, ?body, ?expanded, ?t)) {
// Only fold the expanded expression, not the
// expressions involved in syntax extension
- auto exp = option.get[@expr](expanded);
- auto exp_ = fold_expr(env_, fld, exp);
+ auto exp = fold_expr(env_, fld, expanded);
ret fld.fold_expr_ext(env_, e.span, p, args, body,
- some[@ast.expr](exp_), t);
+ exp, t);
}
case (ast.expr_fail) {
@@ -1184,7 +1183,7 @@ fn identity_fold_expr_path[ENV](&ENV env, &span sp,
fn identity_fold_expr_ext[ENV](&ENV env, &span sp,
&path p, vec[@expr] args,
option.t[@expr] body,
- option.t[@expr] expanded,
+ @expr expanded,
ann a) -> @expr {
ret @respan(sp, ast.expr_ext(p, args, body, expanded, a));
}
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 9fee3dab..2594590a 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3694,7 +3694,7 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result {
}
case (ast.expr_ext(_, _, _, ?expanded, _)) {
- ret trans_expr(cx, option.get[@ast.expr](expanded));
+ ret trans_expr(cx, expanded);
}
case (ast.expr_fail) {
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 5cccc4d7..f8f7fc72 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -1514,11 +1514,10 @@ fn check_expr(&@fn_ctxt fcx, @ast.expr expr) -> @ast.expr {
}
case (ast.expr_ext(?p, ?args, ?body, ?expanded, _)) {
- auto exp_ = check_expr(fcx, option.get[@ast.expr](expanded));
+ auto exp_ = check_expr(fcx, expanded);
auto t = expr_ty(exp_);
ret @fold.respan[ast.expr_](expr.span,
- ast.expr_ext(p, args, body,
- some[@ast.expr](exp_),
+ ast.expr_ext(p, args, body, exp_,
ast.ann_type(t)));
}