Project

General

Profile

Bug #18250 ยป 0001-Give-params-a-name.patch

tenderlovemaking (Aaron Patterson), 10/13/2021 12:40 AM

View differences:

bootstraptest/test_ractor.rb
"ok"
}
assert_equal "ok", %q{
def foo(*); ->{ super }; end
begin
Ractor.make_shareable(foo)
rescue Ractor::IsolationError
"ok"
end
}
assert_equal "ok", %q{
def foo(...); ->{ super }; end
begin
Ractor.make_shareable(foo)
rescue Ractor::IsolationError
"ok"
end
}
end # if !ENV['GITHUB_WORKFLOW']
iseq.c
return val;
}
#define idREST '?'
static VALUE
param_name(ID name)
{
if (name == idREST) {
return Qfalse;
}
else {
return rb_id2str(name);
}
}
VALUE
rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
{
......
#define PARAM_ID(i) body->local_table[(i)]
#define PARAM(i, type) ( \
PARAM_TYPE(type), \
rb_id2str(PARAM_ID(i)) ? \
param_name(PARAM_ID(i)) ? \
rb_ary_push(a, ID2SYM(PARAM_ID(i))) : \
a)
parse.y
# define METHOD_NOT '!'
#endif
#define idREST '?'
#define idFWD_REST '*'
#ifdef RUBY3_KEYWORDS
#define idFWD_KWREST idPow /* Use simple "**", as tDSTAR is "**arg" */
......
| restarg_mark
{
/*%%%*/
$$ = internal_id(p);
arg_var(p, $$);
arg_var(p, idREST);
/*% %*/
/*% ripper: rest_param!(Qnil) %*/
}
test/ruby/test_iseq.rb
assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval)
end
def test_super_with_block
iseq = compile(<<~EOF)
def touch(*) # :nodoc:
foo { super }
end
42
EOF
assert_equal(42, ISeq.load_from_binary(iseq.to_binary).eval)
end
def test_lambda_with_ractor_roundtrip
iseq = compile(<<~EOF)
x = 42
    (1-1/1)