Skip to content

Commit

Permalink
[Truffle] Hash#map with an empty hash.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Mar 12, 2015
1 parent 18d9c88 commit 7fe3c36
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -920,6 +920,11 @@ public MapNode(MapNode prev) {
super(prev);
}

@Specialization(guards = "isNull")
public RubyArray mapNull(VirtualFrame frame, RubyHash hash, RubyProc block) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), null, 0);
}

@ExplodeLoop
@Specialization(guards = {"!isNull", "!isBuckets"})
public RubyArray mapPackedArray(VirtualFrame frame, RubyHash hash, RubyProc block) {
Expand Down

0 comments on commit 7fe3c36

Please sign in to comment.