From 9268ff4f09ce7c3d0d572e12d960483d22bf49f3 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Sun, 24 Jan 2021 13:11:18 +0000 Subject: [PATCH] fix: use new ArrValue variants --- --- a/crates/jrsonnet-evaluator/src/builtin/mod.rs +++ b/crates/jrsonnet-evaluator/src/builtin/mod.rs @@ -379,7 +379,7 @@ 1, to: ty!(number) => Val::Num; ], { if to < from { - return Ok(Val::Arr(Rc::new(Vec::new()))) + return Ok(Val::Arr(ArrValue::new_eager())) } let mut out = Vec::with_capacity((1+to as usize-from as usize).max(0)); for i in from as usize..=to as usize { --- a/crates/jrsonnet-evaluator/src/val.rs +++ b/crates/jrsonnet-evaluator/src/val.rs @@ -179,6 +179,10 @@ Extended(Box<(Self, Self)>), } impl ArrValue { + pub fn new_eager() -> Self { + Self::Eager(Rc::new(Vec::new())) + } + pub fn len(&self) -> usize { match self { Self::Lazy(l) => l.len(), -- gitstuff