ruby-changes:50578
From: nobu <ko1@a...>
Date: Sun, 11 Mar 2018 21:12:15 +0900 (JST)
Subject: [ruby-changes:50578] nobu:r62723 (trunk): parse.y: reduce duplicate code
nobu 2018-03-11 21:12:08 +0900 (Sun, 11 Mar 2018) New Revision: 62723 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62723 Log: parse.y: reduce duplicate code Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 62722) +++ parse.y (revision 62723) @@ -6280,10 +6280,7 @@ here_document(struct parser_params *p, r https://github.com/ruby/ruby/blob/trunk/parse.y#L6280 if (ptr_end < p->lex.pend) rb_str_cat(str, "\n", 1); lex_goto_eol(p); if (p->heredoc_indent > 0) { - set_yylval_str(str); - add_mark_object(p, str); - flush_string_content(p, enc); - return tSTRING_CONTENT; + goto flush_str; } if (nextc(p) == -1) { if (str) { @@ -6315,10 +6312,11 @@ here_document(struct parser_params *p, r https://github.com/ruby/ruby/blob/trunk/parse.y#L6312 goto restore; } if (c != '\n') { - VALUE lit; flush: - add_mark_object(p, lit = STR_NEW3(tok(p), toklen(p), enc, func)); - set_yylval_str(lit); + str = STR_NEW3(tok(p), toklen(p), enc, func); + flush_str: + set_yylval_str(str); + add_mark_object(p, str); flush_string_content(p, enc); return tSTRING_CONTENT; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/