Skip to content

Commit 8e5e36a

Browse files
aardvark179eregon
authored andcommitted
Implement missing rb_eval_cmd_kw function.
1 parent 3316ff0 commit 8e5e36a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

lib/truffle/truffle/cext.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,7 @@ def rb_global_variable(obj)
19531953
end
19541954

19551955
GC_REGISTERED_ADDRESSES = {}
1956+
19561957
def rb_gc_register_address(address, obj)
19571958
Truffle::Interop.to_native(address) unless Truffle::Interop.pointer?(address)
19581959
GC_REGISTERED_ADDRESSES[address] = obj
@@ -1962,4 +1963,13 @@ def rb_gc_unregister_address(address)
19621963
Truffle::Interop.to_native(address) unless Truffle::Interop.pointer?(address)
19631964
GC_REGISTERED_ADDRESSES.delete(address)
19641965
end
1966+
1967+
def rb_eval_cmd_kw(cmd, args, kw_splat)
1968+
case cmd
1969+
when String
1970+
eval(cmd)
1971+
else
1972+
cmd.call(*args)
1973+
end
1974+
end
19651975
end

src/main/c/cext/call.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,7 @@ int rb_method_boundp(VALUE klass, ID id, int ex) {
228228
VALUE rb_exec_recursive(VALUE (*func) (VALUE, VALUE, int), VALUE obj, VALUE arg) {
229229
return rb_tr_wrap(polyglot_invoke(RUBY_CEXT, "rb_exec_recursive", func, rb_tr_unwrap(obj), rb_tr_unwrap(arg)));
230230
}
231+
232+
VALUE rb_eval_cmd_kw(VALUE cmd, VALUE args, int kw_splat) {
233+
return RUBY_CEXT_INVOKE("rb_eval_cmd_kw", cmd, args, INT2FIX(kw_splat));
234+
}

0 commit comments

Comments
 (0)