diff options
| author | Paolo Bosetti <[email protected]> | 2012-08-13 16:26:15 +0200 |
|---|---|---|
| committer | Paolo Bosetti <[email protected]> | 2012-08-13 16:26:15 +0200 |
| commit | 4c56ce2744f4c8640de1b299c4ff4bd749a93345 (patch) | |
| tree | 1286395880c71cd30e0938b020cd154c3317357c /src/codegen.c | |
| parent | 05127776cf0c528b549d723ba2e325332e49ced9 (diff) | |
| parent | cda1709a35ad7d495ec1a08793cd88b78e20c444 (diff) | |
| download | mruby-4c56ce2744f4c8640de1b299c4ff4bd749a93345.tar.gz mruby-4c56ce2744f4c8640de1b299c4ff4bd749a93345.zip | |
Merge branch 'master' into XCode
Diffstat (limited to 'src/codegen.c')
| -rw-r--r-- | src/codegen.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/codegen.c b/src/codegen.c index bf6fd0b3e..38d57d581 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -142,6 +142,9 @@ genop(codegen_scope *s, mrb_code i) s->pc++; } +#define NOVAL 0 +#define VAL 1 + static void genop_peep(codegen_scope *s, mrb_code i, int val) { @@ -217,6 +220,7 @@ genop_peep(codegen_scope *s, mrb_code i, int val) case OP_SETCV: case OP_SETCONST: case OP_SETMCNST: + case OP_SETGLOBAL: if (c0 == OP_MOVE) { if (GETARG_A(i) == GETARG_A(i0)) { s->iseq[s->pc-1] = MKOP_ABx(c1, GETARG_B(i0), GETARG_Bx(i)); @@ -261,6 +265,17 @@ genop_peep(codegen_scope *s, mrb_code i, int val) s->iseq[s->pc-1] = MKOP_ABC(c0, 0, GETARG_B(i0), GETARG_C(i0)); genop(s, MKOP_AB(OP_RETURN, 0, OP_R_NORMAL)); return; + case OP_SETIV: + case OP_SETCV: + case OP_SETCONST: + case OP_SETMCNST: + case OP_SETUPVAR: + case OP_SETGLOBAL: + s->pc--; + genop_peep(s, i0, NOVAL); + i0 = s->iseq[s->pc-1]; + genop(s, MKOP_AB(OP_RETURN, GETARG_A(i0), OP_R_NORMAL)); + return; case OP_LOADSYM: case OP_GETGLOBAL: case OP_GETIV: @@ -436,9 +451,6 @@ lv_idx(codegen_scope *s, mrb_sym id) return 0; } -#define NOVAL 0 -#define VAL 1 - static void for_body(codegen_scope *s, node *tree) { @@ -598,10 +610,10 @@ static int nosplat(node *t) { while (t) { - if ((intptr_t)t->car->car == NODE_SPLAT) return 0; + if ((intptr_t)t->car->car == NODE_SPLAT) return FALSE; t = t->cdr; } - return 1; + return TRUE; } static mrb_sym |
