@@ -85,6 +85,7 @@ struct parse_type_arg {
8585 rb_encoding * encoding ;
8686 rbs_parser_t * parser ;
8787 VALUE require_eof ;
88+ VALUE void_allowed ;
8889};
8990
9091static VALUE ensure_free_parser (VALUE parser ) {
@@ -100,8 +101,10 @@ static VALUE parse_type_try(VALUE a) {
100101 return Qnil ;
101102 }
102103
104+ bool void_allowed = RTEST (arg -> void_allowed );
105+
103106 rbs_node_t * type ;
104- rbs_parse_type (parser , & type );
107+ rbs_parse_type (parser , & type , void_allowed );
105108
106109 raise_error_if_any (parser , arg -> buffer );
107110
@@ -157,7 +160,7 @@ static rbs_parser_t *alloc_parser_from_buffer(VALUE buffer, int start_pos, int e
157160 );
158161}
159162
160- static VALUE rbsparser_parse_type (VALUE self , VALUE buffer , VALUE start_pos , VALUE end_pos , VALUE variables , VALUE require_eof ) {
163+ static VALUE rbsparser_parse_type (VALUE self , VALUE buffer , VALUE start_pos , VALUE end_pos , VALUE variables , VALUE require_eof , VALUE void_allowed ) {
161164 VALUE string = rb_funcall (buffer , rb_intern ("content" ), 0 );
162165 StringValue (string );
163166 rb_encoding * encoding = rb_enc_get (string );
@@ -168,7 +171,8 @@ static VALUE rbsparser_parse_type(VALUE self, VALUE buffer, VALUE start_pos, VAL
168171 .buffer = buffer ,
169172 .encoding = encoding ,
170173 .parser = parser ,
171- .require_eof = require_eof
174+ .require_eof = require_eof ,
175+ .void_allowed = void_allowed
172176 };
173177
174178 VALUE result = rb_ensure (parse_type_try , (VALUE ) & arg , ensure_free_parser , (VALUE ) parser );
@@ -432,7 +436,7 @@ void rbs__init_parser(void) {
432436 VALUE empty_array = rb_obj_freeze (rb_ary_new ());
433437 rb_gc_register_mark_object (empty_array );
434438
435- rb_define_singleton_method (RBS_Parser , "_parse_type" , rbsparser_parse_type , 5 );
439+ rb_define_singleton_method (RBS_Parser , "_parse_type" , rbsparser_parse_type , 6 );
436440 rb_define_singleton_method (RBS_Parser , "_parse_method_type" , rbsparser_parse_method_type , 5 );
437441 rb_define_singleton_method (RBS_Parser , "_parse_signature" , rbsparser_parse_signature , 3 );
438442 rb_define_singleton_method (RBS_Parser , "_parse_type_params" , rbsparser_parse_type_params , 4 );
0 commit comments