@@ -463,21 +463,15 @@ parser_location(VALUE source, bool freeze, uint32_t start, uint32_t length) {
463463/**
464464 * Create a new Location instance from the given parser and slice.
465465 */
466- #define PARSER_LOCATION_SLICE (parser , source , freeze , slice ) \
466+ #define PARSER_LOCATION_SLICE (source , freeze , slice ) \
467467 parser_location(source, freeze, slice.start, slice.length)
468468
469- /**
470- * Create a new Location instance from the given parser and location.
471- */
472- #define PARSER_LOCATION_LOC (parser , source , freeze , loc ) \
473- parser_location(source, freeze, (uint32_t) (loc.start - parser->start), (uint32_t) (loc.end - loc.start))
474-
475469/**
476470 * Build a new Comment instance from the given parser and comment.
477471 */
478472static inline VALUE
479- parser_comment (const pm_parser_t * parser , VALUE source , bool freeze , const pm_comment_t * comment ) {
480- VALUE argv [] = { PARSER_LOCATION_LOC ( parser , source , freeze , comment -> location ) };
473+ parser_comment (VALUE source , bool freeze , const pm_comment_t * comment ) {
474+ VALUE argv [] = { PARSER_LOCATION_SLICE ( source , freeze , comment -> location ) };
481475 VALUE type = (comment -> type == PM_COMMENT_EMBDOC ) ? rb_cPrismEmbDocComment : rb_cPrismInlineComment ;
482476 return rb_class_new_instance_freeze (1 , argv , type , freeze );
483477}
@@ -494,7 +488,7 @@ parser_comments(const pm_parser_t *parser, VALUE source, bool freeze) {
494488 comment != NULL ;
495489 comment = (const pm_comment_t * ) comment -> node .next
496490 ) {
497- VALUE value = parser_comment (parser , source , freeze , comment );
491+ VALUE value = parser_comment (source , freeze , comment );
498492 rb_ary_push (comments , value );
499493 }
500494
@@ -560,7 +554,7 @@ parser_errors(const pm_parser_t *parser, rb_encoding *encoding, VALUE source, bo
560554 ) {
561555 VALUE type = ID2SYM (rb_intern (pm_diagnostic_id_human (error -> diag_id )));
562556 VALUE message = rb_obj_freeze (rb_enc_str_new_cstr (error -> message , encoding ));
563- VALUE location = PARSER_LOCATION_SLICE (parser , source , freeze , error -> location );
557+ VALUE location = PARSER_LOCATION_SLICE (source , freeze , error -> location );
564558
565559 VALUE level = Qnil ;
566560 switch (error -> level ) {
@@ -600,7 +594,7 @@ parser_warnings(const pm_parser_t *parser, rb_encoding *encoding, VALUE source,
600594 ) {
601595 VALUE type = ID2SYM (rb_intern (pm_diagnostic_id_human (warning -> diag_id )));
602596 VALUE message = rb_obj_freeze (rb_enc_str_new_cstr (warning -> message , encoding ));
603- VALUE location = PARSER_LOCATION_SLICE (parser , source , freeze , warning -> location );
597+ VALUE location = PARSER_LOCATION_SLICE (source , freeze , warning -> location );
604598
605599 VALUE level = Qnil ;
606600 switch (warning -> level ) {
0 commit comments