diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-06 23:27:16 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-07 09:23:38 +0900 |
commit | 6baa78bb78315dfb0bc05e933fe6c512a3a098e6 (patch) | |
tree | a90e0b722d375a383a3ef6d70c9219aa0276e700 /parse.y | |
parent | 83b987054a801405673266ba47c6f38e33efee0e (diff) |
Use chomp: option when chomp mode
Get rid of depending on using $/ internally in String#chomp!, and
chomp the separator at once.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5403
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -13127,9 +13127,9 @@ parser_append_options(struct parser_params *p, NODE *node) 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); |