Skip to content

Commit

Permalink
Remove unnecessary _end_loc/_start_loc methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Sep 6, 2024
1 parent 81b44e1 commit 553543d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
11 changes: 0 additions & 11 deletions ext/rbs_extension/location.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,6 @@ static VALUE location_end_pos(VALUE self) {
return INT2FIX(loc->rg.end);
}

// TODO: remove it
static VALUE location_start_loc(VALUE self) {
return Qnil;
}

static VALUE location_end_loc(VALUE self) {
return Qnil;
}

static VALUE location_add_required_child(VALUE self, VALUE name, VALUE start, VALUE end) {
rbs_loc *loc = rbs_check_location(self);

Expand Down Expand Up @@ -293,8 +284,6 @@ void rbs__init_location(void) {
rb_define_method(RBS_Location, "buffer", location_buffer, 0);
rb_define_method(RBS_Location, "start_pos", location_start_pos, 0);
rb_define_method(RBS_Location, "end_pos", location_end_pos, 0);
rb_define_private_method(RBS_Location, "_start_loc", location_start_loc, 0);
rb_define_private_method(RBS_Location, "_end_loc", location_end_loc, 0);
rb_define_method(RBS_Location, "_add_required_child", location_add_required_child, 3);
rb_define_method(RBS_Location, "_add_optional_child", location_add_optional_child, 3);
rb_define_method(RBS_Location, "_add_optional_no_child", location_add_optional_no_child, 1);
Expand Down
8 changes: 2 additions & 6 deletions lib/rbs/location_aux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,11 @@ def end_column
end

def start_loc
@start_loc ||= begin
_start_loc || buffer.pos_to_loc(start_pos)
end
@start_loc ||= buffer.pos_to_loc(start_pos)
end

def end_loc
@end_loc ||= begin
_end_loc || buffer.pos_to_loc(end_pos)
end
@end_loc ||= buffer.pos_to_loc(end_pos)
end

def range
Expand Down
3 changes: 0 additions & 3 deletions sig/location.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ module RBS

private

def _start_loc: () -> Buffer::loc?
def _end_loc: () -> Buffer::loc?

def _add_required_child: (RequiredChildKeys name, Integer start_pos, Integer end_pos) -> void
def _add_optional_child: (OptionalChildKeys name, Integer start_pos, Integer end_pos) -> void
def _add_optional_no_child: (OptionalChildKeys name) -> void
Expand Down

0 comments on commit 553543d

Please sign in to comment.