Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ private static IRubyObject receiverSpecificArityKwargsCommon(ThreadContext conte

// We pass empty kwrest through so kwrest does not try and slurp it up as normal argument.
// This complicates check_arity but empty ** is special case.
RubyHash hash = (RubyHash) last;
RubyHash hash = (RubyHash) last.dup(context);
return hash;
} else if (!isKwarg) {
// This is just an ordinary hash as last argument
Expand Down Expand Up @@ -813,6 +813,8 @@ private static IRubyObject receiveKeywordsWithSplatsNoRestNoKeywords(ThreadConte
clearTrailingHashRuby2Keywords(context, args, hash);
}

args[args.length - 1] = hash.dup(context);

return UNDEFINED;
}

Expand Down Expand Up @@ -840,11 +842,7 @@ private static IRubyObject receiveKeywordsHash(ThreadContext context, IRubyObjec
return hash.dupFast(context);
}

// FIXME: This is a bit gross. a real kwarg callsite if passed to a non-kwarg method but it
// has a rest arg will dup the original kwarg (presumably so you cannot modify the original
// kwarg hash). This should be handled during recv_rest_arg but we no longer have the info so
// it happening here.
if (hasRestArgs) args[args.length - 1] = hash.dup(context);
args[args.length - 1] = hash.dup(context);

// All other situations no-op
return UNDEFINED;
Expand Down