diff options
| -rw-r--r-- | src/backtrace.c | 14 | ||||
| -rw-r--r-- | src/variable.c | 21 |
2 files changed, 9 insertions, 26 deletions
diff --git a/src/backtrace.c b/src/backtrace.c index 25a08bb12..8567f4f5a 100644 --- a/src/backtrace.c +++ b/src/backtrace.c @@ -62,7 +62,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun mrb_callinfo *ci; mrb_int ciidx; const char *filename, *method, *sep; - int i, line; + int i, lineno; func(mrb, stream, 1, "trace:\n"); ciidx = mrb_fixnum(mrb_obj_iv_get(mrb, exc, mrb_intern_lit(mrb, "ciidx"))); @@ -72,7 +72,7 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun for (i = ciidx; i >= 0; i--) { ci = &mrb->c->cibase[i]; filename = NULL; - line = -1; + lineno = -1; if (MRB_PROC_CFUNC_P(ci->proc)) { continue; @@ -91,9 +91,9 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun pc = (mrb_code*)mrb_cptr(mrb_obj_iv_get(mrb, exc, mrb_intern_lit(mrb, "lastpc"))); } filename = mrb_debug_get_filename(irep, pc - irep->iseq); - line = mrb_debug_get_line(irep, pc - irep->iseq); + lineno = mrb_debug_get_line(irep, pc - irep->iseq); } - if (line == -1) continue; + if (lineno == -1) continue; if (ci->target_class == ci->proc->target_class) sep = "."; else @@ -109,18 +109,18 @@ mrb_output_backtrace(mrb_state *mrb, struct RObject *exc, output_stream_func fun if (cn) { func(mrb, stream, 1, "\t[%d] ", i); - func(mrb, stream, 0, "%s:%d:in %s%s%s", filename, line, cn, sep, method); + func(mrb, stream, 0, "%s:%d:in %s%s%s", filename, lineno, cn, sep, method); func(mrb, stream, 1, "\n"); } else { func(mrb, stream, 1, "\t[%d] ", i); - func(mrb, stream, 0, "%s:%d:in %s", filename, line, method); + func(mrb, stream, 0, "%s:%d:in %s", filename, lineno, method); func(mrb, stream, 1, "\n"); } } else { func(mrb, stream, 1, "\t[%d] ", i); - func(mrb, stream, 0, "%s:%d", filename, line); + func(mrb, stream, 0, "%s:%d", filename, lineno); func(mrb, stream, 1, "\n"); } } diff --git a/src/variable.c b/src/variable.c index c66e7fe89..921d465a2 100644 --- a/src/variable.c +++ b/src/variable.c @@ -756,7 +756,7 @@ mrb_cv_get(mrb_state *mrb, mrb_value mod, mrb_sym sym) } void -mrb_mod_cv_set(mrb_state *mrb, struct RClass * c, mrb_sym sym, mrb_value v) +mrb_mod_cv_set(mrb_state *mrb, struct RClass *c, mrb_sym sym, mrb_value v) { struct RClass * cls = c; @@ -823,24 +823,7 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v) struct RClass *c = mrb->c->ci->proc->target_class; if (!c) c = mrb->c->ci->target_class; - while (c) { - if (c->iv) { - iv_tbl *t = c->iv; - - if (iv_get(mrb, t, sym, NULL)) { - mrb_write_barrier(mrb, (struct RBasic*)c); - iv_put(mrb, t, sym, v); - return; - } - } - c = c->super; - } - c = mrb->c->ci->target_class; - if (!c->iv) { - c->iv = iv_new(mrb); - } - mrb_write_barrier(mrb, (struct RBasic*)c); - iv_put(mrb, c->iv, sym, v); + mrb_mod_cv_set(mrb, c, sym, v); } mrb_bool |
