From 930ebdd7ca4dfb9386fcaa52909dadb970163f8e Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 5 Jan 2022 16:00:21 -0800 Subject: YJIT: Support kwargs for cfunc This adds support for passing keyword arguments to cfuncs. This is done by calling a helper method to create the hash from the top N values on the stack (determined by the callinfo) and then moving that value onto the stack. --- test/ruby/test_yjit.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 41a6d50779..88f8e42813 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -523,6 +523,13 @@ class TestYJIT < Test::Unit::TestCase RUBY end + def test_cfunc_kwarg + assert_no_exits('{}.store(:value, foo: 123)') + assert_no_exits('{}.store(:value, foo: 123, bar: 456, baz: 789)') + assert_no_exits('{}.merge(foo: 123)') + assert_no_exits('{}.merge(foo: 123, bar: 456, baz: 789)') + end + def test_ctx_different_mappings # regression test simplified from URI::Generic#hostname= assert_compiles(<<~'RUBY', frozen_string_literal: true) -- cgit v1.2.3