diff options
| author | Brian Anderson <[email protected]> | 2011-01-30 17:18:19 -0500 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-02-10 12:12:10 -0800 |
| commit | 378c0087ca7572cd17726c704fe04d57bf4687af (patch) | |
| tree | c158d769375cee5b19b4be83d314c46acab28b12 /src/comp/middle/fold.rs | |
| parent | Revert EI_OSABI ELF header field back to 0 for Linux (diff) | |
| download | rust-378c0087ca7572cd17726c704fe04d57bf4687af.tar.xz rust-378c0087ca7572cd17726c704fe04d57bf4687af.zip | |
Parse 'be' statement. Pass tailcall tests. No actual tailcalls yet.
Diffstat (limited to 'src/comp/middle/fold.rs')
| -rw-r--r-- | src/comp/middle/fold.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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 @@ -177,6 +177,9 @@ type ast_fold[ENV] = &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, (fn(&ENV e, &span sp, @@ -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](_,_,_), |