private Object lookupRestKeywordArgumentHash(VirtualFrame frame) { final Object hash = readUserKeywordsHashNode.execute(frame); if (noHash.profile(hash == null)) { return Layouts.HASH.createHash( coreLibrary().getHashFactory(), null, 0, null, null, null, null, false); } CompilerDirectives.bailout("Ruby keyword arguments aren't optimized"); final DynamicObject hashObject = (DynamicObject) hash; final List<Map.Entry<Object, Object>> entries = new ArrayList<>(); outer: for (Map.Entry<Object, Object> keyValue : HashOperations.iterableKeyValues(hashObject)) { if (!RubyGuards.isRubySymbol(keyValue.getKey())) { continue; } for (String excludedKeyword : excludedKeywords) { if (excludedKeyword.equals(keyValue.getKey().toString())) { continue outer; } } entries.add(keyValue); } return BucketsStrategy.create( getContext(), entries, Layouts.HASH.getCompareByIdentity(hashObject)); }
@Override public Object execute(VirtualFrame frame) { CompilerDirectives.bailout("blocks with kwargs are not optimized yet"); final Object array = readArrayNode.executeRead(frame); final Object remainingArray = ruby( frame, "Truffle::Primitive.load_arguments_from_array_kw_helper(array, kwrest_name, binding)", "array", array, "kwrest_name", kwrestName, "binding", Layouts.BINDING.createBinding( getContext().getCoreLibrary().getBindingFactory(), frame.materialize())); writeArrayNode.executeWrite(frame, remainingArray); return nil(); }