Skip to content

Commit bca4203

Browse files
committed
Feedback
1 parent 43a913c commit bca4203

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/main/java/org/truffleruby/core/hash/library/HashStoreLibrary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public static HashStoreLibrary createDispatched() {
4747
return FACTORY.createDispatched(HashGuards.hashStrategyLimit());
4848
}
4949

50-
public static HashStoreLibrary createUncached(RubyHash hash) {
50+
public static HashStoreLibrary getUncached(RubyHash hash) {
5151
final Object store = hash.store;
5252
return FACTORY.getUncached(store);
5353
}
5454

5555
public static boolean verify(RubyHash hash) {
5656
final Object store = hash.store;
57-
return createUncached(hash).verify(store, hash);
57+
return getUncached(hash).verify(store, hash);
5858
}
5959

6060
/** Looks up the key in the hash and returns the associated value, or the result of calling {@code defaultNode} if

src/main/java/org/truffleruby/language/arguments/KeywordArgumentsDescriptor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
*/
1010
package org.truffleruby.language.arguments;
1111

12+
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
13+
1214
/** An arguments descriptor that says that keyword arguments were passed (either foo(a: 1) or foo(**kw)). Note that
1315
* currently, if kw is empty, then this descriptor is used even though it is semantically the same as if no keyword
1416
* arguments were passed. The callee must handle that for now. */
1517
public class KeywordArgumentsDescriptor extends ArgumentsDescriptor {
1618

17-
private final String[] keywords;
19+
@CompilationFinal(dimensions = 1) private final String[] keywords;
1820

1921
/** Use {@link KeywordArgumentsDescriptorManager} to get an instance. */
20-
public KeywordArgumentsDescriptor(String[] keywords) {
22+
KeywordArgumentsDescriptor(String[] keywords) {
2123
this.keywords = keywords;
2224
}
2325

src/main/java/org/truffleruby/language/arguments/ReadUserKeywordsHashNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ public RubyHash execute(VirtualFrame frame) {
3535

3636
/** Verify that all keywords the descriptor claims should be in the hash, are in fact in the hash. **/
3737
private boolean assertHashMatchesDescriptor(RubyHash hash, KeywordArgumentsDescriptor descriptor) {
38-
final HashStoreLibrary hashStoreLibrary = HashStoreLibrary.createUncached(hash);
38+
final HashStoreLibrary hashStoreLibrary = HashStoreLibrary.getUncached(hash);
3939

4040
for (String keyword : descriptor.getKeywords()) {
4141
final RubySymbol symbol = getSymbol(keyword);
4242
final Object value = hashStoreLibrary.lookupOrDefault(hash.store, null, hash, symbol, (f, h, k) -> null);
4343
assert value != null : "descriptor claims " + keyword +
44-
" was a passed as a keyword argument but it's not in the hash";
44+
" was passed as a keyword argument but it's not in the hash";
4545
}
4646
return true;
4747
}

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.truffleruby.core.rope.RopeConstants;
6060
import org.truffleruby.core.string.FrozenStrings;
6161
import org.truffleruby.core.string.InterpolatedStringNode;
62+
import org.truffleruby.core.string.StringUtils;
6263
import org.truffleruby.core.support.TypeNodes;
6364
import org.truffleruby.core.string.ImmutableRubyString;
6465
import org.truffleruby.language.LexicalScope;
@@ -3149,7 +3150,7 @@ private static ArgumentsDescriptor getKeywordArgumentsDescriptor(RubyLanguage la
31493150

31503151
if (splat || nonKeywordKeys || !keywords.isEmpty()) {
31513152
return language.keywordArgumentsDescriptorManager
3152-
.getArgumentsDescriptor(keywords.toArray(n -> new String[n]));
3153+
.getArgumentsDescriptor(keywords.toArray(StringUtils.EMPTY_STRING_ARRAY));
31533154
} else {
31543155
return EmptyArgumentsDescriptor.INSTANCE;
31553156
}

0 commit comments

Comments
 (0)