ruby-changes:70775
From: Nobuyoshi <ko1@a...>
Date: Fri, 7 Jan 2022 09:24:06 +0900 (JST)
Subject: [ruby-changes:70775] 6baa78bb78 (master): Use chomp: option when chomp mode
https://git.ruby-lang.org/ruby.git/commit/?id=6baa78bb78 From 6baa78bb78315dfb0bc05e933fe6c512a3a098e6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 6 Jan 2022 23:27:16 +0900 Subject: Use chomp: option when chomp mode Get rid of depending on using $/ internally in String#chomp!, and chomp the separator at once. --- parse.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parse.y b/parse.y index 0c30111f9e3..ffef9955cc3 100644 --- a/parse.y +++ b/parse.y @@ -13127,9 +13127,9 @@ parser_append_options(struct parser_params *p, NODE *node) https://github.com/ruby/ruby/blob/trunk/parse.y#L13127 node = block_append(p, split, node); } if (p->do_chomp) { - NODE *chomp = NEW_CALL(NEW_GVAR(idLASTLINE, LOC), - rb_intern("chomp!"), 0, LOC); - node = block_append(p, chomp, node); + NODE *chomp = NEW_LIT(ID2SYM(rb_intern("chomp")), LOC); + chomp = list_append(p, NEW_LIST(chomp, LOC), NEW_TRUE(LOC)); + irs = list_append(p, irs, NEW_HASH(chomp, LOC)); } node = NEW_WHILE(NEW_FCALL(idGets, irs, LOC), node, 1, LOC); -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/