Skip to content

Commit 00a7ce4

Browse files
author
Nicolas Laurent
committed
allow parsing endless ranges
1 parent 3ea67e4 commit 00a7ce4

File tree

5 files changed

+4004
-3943
lines changed

5 files changed

+4004
-3943
lines changed

spec/tags/language/range_tags.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/java/org/truffleruby/core/range/RangeNodes.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ protected DynamicObject longRange(DynamicObject rubyClass, long begin, long end,
479479
return Layouts.LONG_RANGE.createLongRange(coreLibrary().longRangeFactory, excludeEnd, begin, end);
480480
}
481481

482+
// TODO add specialization for nil end
483+
482484
@Specialization(guards = { "rubyClass != rangeClass || (!isIntOrLong(begin) || !isIntOrLong(end))" })
483485
protected Object objectRange(
484486
VirtualFrame frame,
@@ -502,9 +504,9 @@ protected Object objectRange(
502504
throw new RaiseException(getContext(), coreExceptions().argumentError("bad value for range", this));
503505
}
504506

505-
if (cmpResult == nil()) {
506-
throw new RaiseException(getContext(), coreExceptions().argumentError("bad value for range", this));
507-
}
507+
// if (cmpResult == nil()) { // TODO this throws
508+
// throw new RaiseException(getContext(), coreExceptions().argumentError("bad value for range", this));
509+
// }
508510

509511
return allocateNode.allocate(rubyClass, excludeEnd, begin, end);
510512
}

0 commit comments

Comments
 (0)