diff options
| author | Graydon Hoare <[email protected]> | 2010-10-22 15:37:42 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-10-22 15:37:42 -0700 |
| commit | 6d47d2abdee023f46b35b95e26e418ab9d67d39c (patch) | |
| tree | 1de9d41c4903b1fd1f8b6cf233d68c8fb7a4d7c4 /src/comp/middle/fold.rs | |
| parent | rustboot: If the user tries to instantiate a non-parametric type with type pa... (diff) | |
| download | rust-6d47d2abdee023f46b35b95e26e418ab9d67d39c.tar.xz rust-6d47d2abdee023f46b35b95e26e418ab9d67d39c.zip | |
Implement check-exprs, un-xfail 5 rustc tests.
Diffstat (limited to 'src/comp/middle/fold.rs')
| -rw-r--r-- | src/comp/middle/fold.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index 4dd10871..eeea6bba 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -120,6 +120,9 @@ type ast_fold[ENV] = @expr e) -> @stmt) fold_stmt_log, (fn(&ENV e, &span sp, + @expr e) -> @stmt) fold_stmt_check_expr, + + (fn(&ENV e, &span sp, @expr e) -> @stmt) fold_stmt_expr, // Item folds. @@ -393,6 +396,11 @@ fn fold_stmt[ENV](&ENV env, ast_fold[ENV] fld, &@stmt s) -> @stmt { ret fld.fold_stmt_log(env_, s.span, ee); } + case (ast.stmt_check_expr(?e)) { + auto ee = fold_expr(env_, fld, e); + ret fld.fold_stmt_check_expr(env_, s.span, ee); + } + case (ast.stmt_expr(?e)) { auto ee = fold_expr(env_, fld, e); ret fld.fold_stmt_expr(env_, s.span, ee); @@ -645,6 +653,10 @@ fn identity_fold_stmt_log[ENV](&ENV e, &span sp, @expr x) -> @stmt { ret @respan(sp, ast.stmt_log(x)); } +fn identity_fold_stmt_check_expr[ENV](&ENV e, &span sp, @expr x) -> @stmt { + ret @respan(sp, ast.stmt_check_expr(x)); +} + fn identity_fold_stmt_expr[ENV](&ENV e, &span sp, @expr x) -> @stmt { ret @respan(sp, ast.stmt_expr(x)); } @@ -765,6 +777,8 @@ 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_log = bind identity_fold_stmt_log[ENV](_,_,_), + fold_stmt_check_expr + = bind identity_fold_stmt_check_expr[ENV](_,_,_), fold_stmt_expr = bind identity_fold_stmt_expr[ENV](_,_,_), fold_item_fn = bind identity_fold_item_fn[ENV](_,_,_,_,_), |