mruby-proc-ext/proc.c: use mrb_debug_get_position()

This commit is contained in:
Yukihiro "Matz" Matsumoto
2023-03-26 22:15:45 +09:00
parent 6629112291
commit a3fc6ae53c
+4 -7
View File
@@ -51,16 +51,13 @@ proc_inspect(mrb_state *mrb, mrb_value self)
int32_t line;
mrb_str_cat_lit(mrb, str, " ");
filename = mrb_debug_get_filename(mrb, irep, 0);
mrb_str_cat_cstr(mrb, str, filename ? filename : "-");
mrb_str_cat_lit(mrb, str, ":");
line = mrb_debug_get_line(mrb, irep, 0);
if (line != -1) {
if (mrb_debug_get_position(mrb, irep, 0, &line, &filename)) {
mrb_str_cat_cstr(mrb, str, filename);
mrb_str_cat_lit(mrb, str, ":");
mrb_str_concat(mrb, str, mrb_fixnum_value(line));
}
else {
mrb_str_cat_lit(mrb, str, "-");
mrb_str_cat_lit(mrb, str, "-:-");
}
}