зеркало из https://github.com/github/ruby.git
tracepoint_inspect: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
This commit is contained in:
Родитель
1bf0d36171
Коммит
2071c61e42
12
vm_trace.c
12
vm_trace.c
|
@ -1455,7 +1455,7 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
|
|||
{
|
||||
VALUE sym = rb_tracearg_method_id(trace_arg);
|
||||
if (NIL_P(sym))
|
||||
goto default_inspect;
|
||||
break;
|
||||
return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d in `%"PRIsVALUE"'>",
|
||||
rb_tracearg_event(trace_arg),
|
||||
rb_tracearg_path(trace_arg),
|
||||
|
@ -1477,12 +1477,12 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
|
|||
rb_tracearg_event(trace_arg),
|
||||
rb_tracearg_self(trace_arg));
|
||||
default:
|
||||
default_inspect:
|
||||
return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d>",
|
||||
rb_tracearg_event(trace_arg),
|
||||
rb_tracearg_path(trace_arg),
|
||||
FIX2INT(rb_tracearg_lineno(trace_arg)));
|
||||
break;
|
||||
}
|
||||
return rb_sprintf("#<TracePoint:%"PRIsVALUE"@%"PRIsVALUE":%d>",
|
||||
rb_tracearg_event(trace_arg),
|
||||
rb_tracearg_path(trace_arg),
|
||||
FIX2INT(rb_tracearg_lineno(trace_arg)));
|
||||
}
|
||||
else {
|
||||
return rb_sprintf("#<TracePoint:%s>", tp->tracing ? "enabled" : "disabled");
|
||||
|
|
Загрузка…
Ссылка в новой задаче