diff options
| author | Brian Anderson <[email protected]> | 2011-03-24 21:04:29 -0400 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-25 11:01:52 -0700 |
| commit | 71f058499a0e551d2b8deb5d098bdb04387dc021 (patch) | |
| tree | 4e14a52c8c0092f332c3c9477b85b97799310244 /src/comp/middle/fold.rs | |
| parent | Add test for local declarations with receive. XFAIL in rustc. (diff) | |
| download | rust-71f058499a0e551d2b8deb5d098bdb04387dc021.tar.xz rust-71f058499a0e551d2b8deb5d098bdb04387dc021.zip | |
Refactor ast.local to make room for initialization via recv
Diffstat (limited to 'src/comp/middle/fold.rs')
| -rw-r--r-- | src/comp/middle/fold.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index a1b77612..b59a1f3b 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -437,7 +437,7 @@ fn fold_decl[ENV](&ENV env, ast_fold[ENV] fld, @decl d) -> @decl { alt (d.node) { case (ast.decl_local(?local)) { auto ty_ = none[@ast.ty]; - auto init_ = none[@ast.expr]; + auto initopt = none[ast.initializer]; alt (local.ty) { case (some[@ast.ty](?t)) { ty_ = some[@ast.ty](fold_ty(env, fld, t)); @@ -445,12 +445,14 @@ fn fold_decl[ENV](&ENV env, ast_fold[ENV] fld, @decl d) -> @decl { case (_) { /* fall through */ } } alt (local.init) { - case (some[@ast.expr](?e)) { - init_ = some[@ast.expr](fold_expr(env, fld, e)); + case (some[ast.initializer](?init)) { + auto init_ = rec(expr = fold_expr(env, fld, init.expr) + with init); + initopt = some[ast.initializer](init_); } case (_) { /* fall through */ } } - let @ast.local local_ = @rec(ty=ty_, init=init_ with *local); + let @ast.local local_ = @rec(ty=ty_, init=initopt with *local); ret fld.fold_decl_local(env_, d.span, local_); } |