From 80a46545d284809c292f7a5547b5abeaa331799d Mon Sep 17 00:00:00 2001 From: Masataka Pocke Kuwabara Date: Fri, 6 Sep 2024 11:27:34 +0900 Subject: [PATCH] Remove unnecessary _end_loc/_start_loc methods --- ext/rbs_extension/location.c | 11 ----------- lib/rbs/location_aux.rb | 8 ++------ sig/location.rbs | 3 --- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/ext/rbs_extension/location.c b/ext/rbs_extension/location.c index edbe7b8ef..29384f442 100644 --- a/ext/rbs_extension/location.c +++ b/ext/rbs_extension/location.c @@ -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); @@ -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); diff --git a/lib/rbs/location_aux.rb b/lib/rbs/location_aux.rb index bfdabce92..de0413686 100644 --- a/lib/rbs/location_aux.rb +++ b/lib/rbs/location_aux.rb @@ -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 diff --git a/sig/location.rbs b/sig/location.rbs index 643080b9d..f9588ddc7 100644 --- a/sig/location.rbs +++ b/sig/location.rbs @@ -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