Make the expanded expression in expr_ext not optional
This commit is contained in:
parent
7cef1b3a0f
commit
c1e6f5328c
5 changed files with 9 additions and 11 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue