Improve range parsing and handling (#2506)

* Improve range parsing and handling

* linting
This commit is contained in:
Jonathan Turner
2020-09-07 14:43:58 +12:00
committed by GitHub
parent 986b427038
commit c9ffd6afc0
7 changed files with 172 additions and 44 deletions

View File

@ -86,8 +86,13 @@ struct RangeIterator {
impl RangeIterator {
pub fn new(range: Range, tag: Tag) -> RangeIterator {
let start = match range.from.0.item {
Primitive::Nothing => Primitive::Int(0.into()),
x => x,
};
RangeIterator {
curr: range.from.0.item,
curr: start,
end: range.to.0.item,
tag,
is_end_inclusive: matches!(range.to.1, RangeInclusion::Inclusive),