ruby-changes:59481
From: Nobuyoshi <ko1@a...>
Date: Wed, 25 Dec 2019 16:38:18 +0900 (JST)
Subject: [ruby-changes:59481] 56e002981f (master): Show the error line only when same as the current
https://git.ruby-lang.org/ruby.git/commit/?id=56e002981f From 56e002981fab73a94c6038cb9de82aba6ff84eb4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 25 Dec 2019 14:47:31 +0900 Subject: Show the error line only when same as the current diff --git a/parse.y b/parse.y index 6d9bfc9..1281eb6 100644 --- a/parse.y +++ b/parse.y @@ -5631,7 +5631,18 @@ static void ruby_show_error_line(VALUE errbuf, const YYLTYPE *yylloc, int lineno https://github.com/ruby/ruby/blob/trunk/parse.y#L5631 static inline void parser_show_error_line(struct parser_params *p, const YYLTYPE *yylloc) { - ruby_show_error_line(p->error_buffer, yylloc, p->ruby_sourceline, p->lex.lastline); + VALUE str; + int lineno = p->ruby_sourceline; + if (!yylloc) { + return; + } + else if (yylloc->beg_pos.lineno == lineno) { + str = p->lex.lastline; + } + else { + return; + } + ruby_show_error_line(p->error_buffer, yylloc, lineno, str); } static int -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/