Skip to content

Commit 736a950

Browse files
committed
Refactor Array#[] and remove duplicated condition
Condition `length < 0` `ArrayNodes.IndexNode.slice` is also check a bit later in `ReadSliceNormalizedNode.readNegativeLength`.
1 parent 0024fdd commit 736a950

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

src/main/java/org/truffleruby/core/array/ArrayNodes.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,6 @@ protected Object indexFallback(RubyArray array, Object index, NotProvided length
305305
protected Object slice(RubyArray array, int start, int length,
306306
@Cached ReadSliceNormalizedNode readSliceNode,
307307
@Cached ConditionProfile negativeIndexProfile) {
308-
if (length < 0) {
309-
return nil;
310-
}
311308
if (negativeIndexProfile.profile(start < 0)) {
312309
start += array.size;
313310
}

0 commit comments

Comments
 (0)