Skip to content

Commit

Permalink
Merge branch 'master' into yjit-tailcall-fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
XrXr authored Jan 29, 2024
2 parents 1cc47c4 + bbb7ab9 commit d80f10b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 4 additions & 2 deletions prism_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2881,8 +2881,10 @@ pm_compile_destructured_param_locals(const pm_multi_target_node_t *node, st_tabl
const pm_node_t *left = node->lefts.nodes[index];

if (PM_NODE_TYPE_P(left, PM_REQUIRED_PARAMETER_NODE)) {
pm_insert_local_index(((const pm_required_parameter_node_t *) left)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++;
if (!PM_NODE_FLAG_P(left, PM_PARAMETER_FLAGS_REPEATED_PARAMETER)) {
pm_insert_local_index(((const pm_required_parameter_node_t *) left)->name, local_index, index_lookup_table, local_table_for_iseq, scope_node);
local_index++;
}
} else {
RUBY_ASSERT(PM_NODE_TYPE_P(left, PM_MULTI_TARGET_NODE));
local_index = pm_compile_destructured_param_locals((const pm_multi_target_node_t *) left, index_lookup_table, local_table_for_iseq, scope_node, local_index);
Expand Down
5 changes: 5 additions & 0 deletions test/ruby/test_compile_prism.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,11 @@ def test_BlockParametersNode
assert_prism_eval("Object.tap { || }")
assert_prism_eval("[1].map { |num| num }")
assert_prism_eval("[1].map { |a; b| b = 2; a + b}")

# Test block parameters with multiple _
assert_prism_eval(<<~RUBY)
[[1, 2, 3, 4, 5, 6]].map { |(_, _, _, _, _, _)| _ }
RUBY
end

def test_FowardingParameterNode
Expand Down
2 changes: 1 addition & 1 deletion test/ruby/test_regexp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ def test_bug_20207 # [Bug #20207]

def test_bug_20212 # [Bug #20212]
regex = Regexp.new(
/\A((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+).((?=.*?[a-z])(?!.*--)[a-zd]+[a-zd-]*[a-zd]+)\Z/x
/\A((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z\d]+[a-z\d-]*[a-z\d]+).((?=.*?[a-z])(?!.*--)[a-z]+[a-z-]*[a-z]+).((?=.*?[a-z])(?!.*--)[a-z]+[a-z-]*[a-z]+)\Z/x
)
string = "www.google.com"
100.times.each { assert(regex.match?(string)) }
Expand Down
5 changes: 5 additions & 0 deletions test/ruby/test_rubyoptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ class TestRubyOptions < Test::Unit::TestCase
def self.rjit_enabled? = defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled?
def self.yjit_enabled? = defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?

# Here we're defining our own RUBY_DESCRIPTION without "+PRISM". We do this
# here so that the various tests that reference RUBY_DESCRIPTION don't have to
# worry about it. The flag itself is tested in its own test.
RUBY_DESCRIPTION = ::RUBY_DESCRIPTION.sub(/\+PRISM /, '')

NO_JIT_DESCRIPTION =
if rjit_enabled?
RUBY_DESCRIPTION.sub(/\+RJIT /, '')
Expand Down

0 comments on commit d80f10b

Please sign in to comment.