diff options
| author | Rafael Ávila de Espíndola <[email protected]> | 2011-03-11 17:29:53 -0500 |
|---|---|---|
| committer | Rafael Ávila de Espíndola <[email protected]> | 2011-03-11 17:35:33 -0500 |
| commit | 74d891517be8f6299b0626c26400dd54dd1aac6c (patch) | |
| tree | ef74eac61cfca9c57973a41622ac35a5cd164d25 /src/comp/middle | |
| parent | Re-XFAIL size-and-align.rs to put out burning tinderbox (diff) | |
| download | rust-74d891517be8f6299b0626c26400dd54dd1aac6c.tar.xz rust-74d891517be8f6299b0626c26400dd54dd1aac6c.zip | |
reindex the block index.
Diffstat (limited to 'src/comp/middle')
| -rw-r--r-- | src/comp/middle/fold.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index d08b979a..37ae2c23 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -734,6 +734,7 @@ fn fold_stmt[ENV](&ENV env, ast_fold[ENV] fld, &@stmt s) -> @stmt { fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block { + auto index = new_str_hash[ast.block_index_entry](); let ENV env_ = fld.update_env_for_block(env, blk); if (!fld.keep_going(env_)) { @@ -742,7 +743,9 @@ fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block { let vec[@ast.stmt] stmts = vec(); for (@ast.stmt s in blk.node.stmts) { - append[@ast.stmt](stmts, fold_stmt[ENV](env_, fld, s)); + auto new_stmt = fold_stmt[ENV](env_, fld, s); + append[@ast.stmt](stmts, new_stmt); + ast.index_stmt(index, new_stmt); } auto expr = none[@ast.expr]; @@ -755,8 +758,7 @@ fn fold_block[ENV](&ENV env, ast_fold[ENV] fld, &block blk) -> block { } } - // FIXME: should we reindex? - ret respan(blk.span, rec(stmts=stmts, expr=expr, index=blk.node.index)); + ret respan(blk.span, rec(stmts=stmts, expr=expr, index=index)); } fn fold_arm[ENV](&ENV env, ast_fold[ENV] fld, &arm a) -> arm { |