From 20298650f8332b6df555af594dc4fd8c6d1126ee Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Thu, 10 Aug 2023 17:57:32 +0000 Subject: [PATCH] fix: lazy array initialization --- --- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs +++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs @@ -18,8 +18,8 @@ throw, typed::Typed, val::{CachedUnbound, IndexableVal, StrValue, Thunk, ThunkValue}, - Context, GcHashMap, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result, State, - Unbound, Val, + Context, GcHashMap, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result, ResultExt, + State, Unbound, Val, }; pub mod destructure; pub mod operator; @@ -134,13 +134,13 @@ let fctx = Pending::new(); let mut new_bindings = GcHashMap::with_capacity(var.capacity_hint()); - let value = Thunk::evaluated(Val::Arr(ArrValue::lazy(Cc::new(vec![ + let value = Thunk::evaluated(Val::Arr(ArrValue::lazy(vec![ Thunk::evaluated(Val::Str(StrValue::Flat(field.clone()))), Thunk::new(ObjectFieldThunk { field: field.clone(), obj: obj.clone(), }), - ])))); + ]))); destruct(var, value, fctx.clone(), &mut new_bindings)?; let ctx = ctx .clone() --- a/crates/jrsonnet-parser/src/expr.rs +++ b/crates/jrsonnet-parser/src/expr.rs @@ -26,6 +26,7 @@ #[cfg_attr(feature = "structdump", derive(Codegen))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[derive(Debug, Clone, Copy, PartialEq, Eq, Trace)] +#[repr(u8)] pub enum Visibility { /// : Normal, -- gitstuff