diff options
| author | Felix Jones <[email protected]> | 2016-11-10 20:01:59 +0000 |
|---|---|---|
| committer | Felix Jones <[email protected]> | 2016-11-10 20:01:59 +0000 |
| commit | 70aa6dc38d75dd6b1e2c76f290bc576e36e36ea3 (patch) | |
| tree | 2169dd999e756702a696dbd1be553b7560c2416b /src | |
| parent | cc5f40b2dbcd8e0ea703e820dcf203619b5f1003 (diff) | |
| parent | 3f002b6993df9ea4843e2479d706e7426d57bb5a (diff) | |
| download | mruby-70aa6dc38d75dd6b1e2c76f290bc576e36e36ea3.tar.gz mruby-70aa6dc38d75dd6b1e2c76f290bc576e36e36ea3.zip | |
Merge branch 'master' into android.rake-ndk-clang
Diffstat (limited to 'src')
| -rw-r--r-- | src/variable.c | 8 | ||||
| -rw-r--r-- | src/vm.c | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/variable.c b/src/variable.c index 3b5674923..29f43e69d 100644 --- a/src/variable.c +++ b/src/variable.c @@ -760,13 +760,15 @@ mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym) { struct RClass * cls = c; mrb_value v; + int given = FALSE; while (c) { if (c->iv && iv_get(mrb, c->iv, sym, &v)) { - return v; + given = TRUE; } c = c->super; } + if (given) return v; if (cls && cls->tt == MRB_TT_SCLASS) { mrb_value klass; @@ -774,12 +776,14 @@ mrb_mod_cv_get(mrb_state *mrb, struct RClass * c, mrb_sym sym) mrb_intern_lit(mrb, "__attached__")); c = mrb_class_ptr(klass); if (c->tt == MRB_TT_CLASS || c->tt == MRB_TT_MODULE) { + given = FALSE; while (c) { if (c->iv && iv_get(mrb, c->iv, sym, &v)) { - return v; + given = TRUE; } c = c->super; } + if (given) return v; } } mrb_name_error(mrb, sym, "uninitialized class variable %S in %S", @@ -1513,6 +1513,7 @@ RETRY_TRY_BLOCK: /* A B return R(A) (B=normal,in-block return/break) */ if (mrb->exc) { mrb_callinfo *ci; + mrb_value *stk; int eidx; L_RAISE: @@ -1524,6 +1525,7 @@ RETRY_TRY_BLOCK: if (ci->ridx == 0) goto L_STOP; goto L_RESCUE; } + stk = mrb->c->stack; while (ci[0].ridx == ci[-1].ridx) { cipop(mrb); ci = mrb->c->ci; @@ -1533,6 +1535,7 @@ RETRY_TRY_BLOCK: MRB_THROW(prev_jmp); } if (ci == mrb->c->cibase) { + mrb->c->stack = stk; while (eidx > 0) { ecall(mrb, --eidx); } |
