diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-11-24 21:25:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-11-24 21:25:27 +0900 |
| commit | 22f73250dbe38dd1b5878143b81284f510d91923 (patch) | |
| tree | 63ce3074501f51ad7c79ee9a96de5c5241d6a638 | |
| parent | 0c924b92872a96b29f3fe8462ab57d33dfb7b9b6 (diff) | |
| download | mruby-22f73250dbe38dd1b5878143b81284f510d91923.tar.gz mruby-22f73250dbe38dd1b5878143b81284f510d91923.zip | |
redo should work well in for statement; fix #3275
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 6d3ece9aa..0c84dd558 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -588,9 +588,6 @@ for_body(codegen_scope *s, node *tree) push(); /* push for a block parameter */ - lp = loop_push(s, LOOP_FOR); - lp->pc1 = new_label(s); - /* generate loop variable */ n2 = tree->car; genop(s, MKOP_Ax(OP_ENTER, 0x40000)); @@ -600,6 +597,11 @@ for_body(codegen_scope *s, node *tree) else { gen_vmassignment(s, n2, 1, VAL); } + /* construct loop */ + lp = loop_push(s, LOOP_FOR); + lp->pc2 = new_label(s); + + /* loop body */ codegen(s, tree->cdr->cdr->car, VAL); pop(); if (s->pc > 0) { |
