Skip to content

Commit

Permalink
Let the docs of base_label and label be similar
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn authored and byroot committed Mar 25, 2024
1 parent dadaa11 commit 3b4dacf
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions vm_backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,14 @@ location_label(rb_backtrace_location_t *loc)
* 1.times do
* puts caller_locations(0).first.label
* end
*
* end
* end
*
* The result of calling +foo+ is this:
*
* label: foo
* label: block in foo
* label: block (2 levels) in foo
* foo
* block in foo
* block (2 levels) in foo
*
*/
static VALUE
Expand All @@ -315,10 +314,28 @@ location_base_label(rb_backtrace_location_t *loc)
}

/*
* Returns the label of this frame without decoration.
* Returns the base label of this frame, which is usually equal to the label,
* without decoration.
*
* Consider the following example:
*
* def foo
* puts caller_locations(0).first.base_label
*
* 1.times do
* puts caller_locations(0).first.base_label
*
* 1.times do
* puts caller_locations(0).first.base_label
* end
* end
* end
*
* The result of calling +foo+ is this:
*
* For example, if the label is `foo`, this method returns `foo` as well, but if
* the label is +rescue in foo+, this method returns just +foo+.
* foo
* foo
* foo
*/
static VALUE
location_base_label_m(VALUE self)
Expand Down

0 comments on commit 3b4dacf

Please sign in to comment.