From 378c0087ca7572cd17726c704fe04d57bf4687af Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 30 Jan 2011 17:18:19 -0500 Subject: Parse 'be' statement. Pass tailcall tests. No actual tailcalls yet. --- src/comp/middle/fold.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/comp/middle/fold.rs') diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index 7e5c2d26..9194f734 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -176,6 +176,9 @@ type ast_fold[ENV] = (fn(&ENV e, &span sp, &option.t[@expr] rv) -> @stmt) fold_stmt_ret, + (fn(&ENV e, &span sp, + @expr e) -> @stmt) fold_stmt_be, + (fn(&ENV e, &span sp, @expr e) -> @stmt) fold_stmt_log, @@ -636,6 +639,11 @@ fn fold_stmt[ENV](&ENV env, ast_fold[ENV] fld, &@stmt s) -> @stmt { ret fld.fold_stmt_ret(env_, s.span, oee); } + case (ast.stmt_be(?e)) { + auto ee = fold_expr(env_, fld, e); + ret fld.fold_stmt_be(env_, s.span, ee); + } + case (ast.stmt_log(?e)) { auto ee = fold_expr(env_, fld, e); ret fld.fold_stmt_log(env_, s.span, ee); @@ -1136,6 +1144,10 @@ fn identity_fold_stmt_ret[ENV](&ENV env, &span sp, ret @respan(sp, ast.stmt_ret(rv)); } +fn identity_fold_stmt_be[ENV](&ENV env, &span sp, @expr x) -> @stmt { + ret @respan(sp, ast.stmt_be(x)); +} + fn identity_fold_stmt_log[ENV](&ENV e, &span sp, @expr x) -> @stmt { ret @respan(sp, ast.stmt_log(x)); } @@ -1366,6 +1378,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] { fold_stmt_decl = bind identity_fold_stmt_decl[ENV](_,_,_), fold_stmt_ret = bind identity_fold_stmt_ret[ENV](_,_,_), + fold_stmt_be = bind identity_fold_stmt_be[ENV](_,_,_), fold_stmt_log = bind identity_fold_stmt_log[ENV](_,_,_), fold_stmt_check_expr = bind identity_fold_stmt_check_expr[ENV](_,_,_), -- cgit v1.2.3