NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for
`foo(k: 1)`.
nd_alen had been abused for the flag (and the implementation is
completely the same), but an explicit name is better to read.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Possible fix would be https://github.com/bundler/bundler/pull/7038,
but Ruby script ending with `^~~` could be wrongly stripped by that?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
For unknown reason, setup_args processed the arguments from the last to
the first. This is not only difficult to read, but also inefficient in
some cases. For example, the arguments of `foo(*a1, *a2, *a3)` was
compiled like `a1.dup << (a2.dup << a3)`. The second dup (`a2.dup`) is
not needed.
This change refactors the function so that it processes the arguments
forward: `foo(*a1, *a2, *a3)` is compiled as `a1.dup << a2 << a3`, and
in my opinion, the source code is now much more readable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parse_atmark): exclude punctuation follows @ marks,
whereas it is inclusive after $ mark as some punctuation global
variables exist.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
compile_array function had three usages: array literal, hash literal,
and method arguments. I think the third is completely different than the
first and second. For example, method arguments and popped are
meaningless; keywords_ptr and flag parameter for array/hash literal is
also unused.
This change refactors them: a function "compile_args" is created for the
third, and removes no longer used parameters of "compile_array".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (parse_gvar): show the source line erred by invalid
global variable, and indicate the variable including the wrong
punctuation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (ruby_show_error_line): hoisted out from parser_yyerror.
* parse.y (regx_options): revert r67226 and show the error line
separately.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Feature #15415][ruby-core:90536]
Co-authored-by: Eric Wong <normalperson@yhbt.net>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
A Yielder object can now be directly passed to another method as a
block argument.
```ruby
enum = Enumerator.new { |y|
Dir.glob("*.rb") { |file|
File.open(file) { |f| f.each_line(&y) }
}
}
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c (int_pow): fix infinite loop in the case of y equal 1
and power of x does not overflow.
[ruby-core:91734] [Bug #15651]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): add ignored_sp
event which will be fired from Ripper::Lexer#on_heredoc_dedent
method. [ruby-core:91727] [Bug #15648]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for types Float, Bignum and Symbol as they do not have references
and singleton classes.
[Fix GH-2091]
From: Lourens Naudé <lourens@bearmetal.eu>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
When `GEM_HOME` was shared with CRuby and JRuby. RubyGems try to
handle both platforms. It should be ignored the different platform.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (rb_io_getline_fast): chomp CR followed by LF but separated
by the read buffer boundary. [ruby-core:91707] [Bug #15642]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e