Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Adding null array specialization for Array#compact
  • Loading branch information
bjfish committed Apr 3, 2015
1 parent 2d6b3f6 commit 539b3da
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -825,6 +825,11 @@ public Object compactObjects(RubyArray array) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), newStore, m);
}

@Specialization(guards = "isNullArray")
public Object compactNull(RubyArray array) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), null, 0);
}

}

@CoreMethod(names = "compact!", raiseIfFrozenSelf = true)
Expand Down

0 comments on commit 539b3da

Please sign in to comment.