From ea99ae66b713bb9c772690b685d2f9aeddc6a6e0 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 1 May 2024 23:25:47 +0200 Subject: [PATCH] fix: preserve_order arg defaults --- crates/jrsonnet-stdlib/src/arrays.rs | 1 + crates/jrsonnet-stdlib/src/objects.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/jrsonnet-stdlib/src/arrays.rs b/crates/jrsonnet-stdlib/src/arrays.rs index 08f0055d..0346dfd1 100644 --- a/crates/jrsonnet-stdlib/src/arrays.rs +++ b/crates/jrsonnet-stdlib/src/arrays.rs @@ -322,6 +322,7 @@ pub fn builtin_flatten_deep_array(value: Val) -> Result> { #[builtin] pub fn builtin_prune( a: Val, + #[default(false)] #[cfg(feature = "exp-preserve-order")] preserve_order: bool, diff --git a/crates/jrsonnet-stdlib/src/objects.rs b/crates/jrsonnet-stdlib/src/objects.rs index 664e42c3..45e0a642 100644 --- a/crates/jrsonnet-stdlib/src/objects.rs +++ b/crates/jrsonnet-stdlib/src/objects.rs @@ -57,7 +57,9 @@ pub fn builtin_object_values_ex( o: ObjValue, include_hidden: bool, - #[cfg(feature = "exp-preserve-order")] preserve_order: bool, + #[default(false)] + #[cfg(feature = "exp-preserve-order")] + preserve_order: bool, ) -> ArrValue { o.values_ex( include_hidden, @@ -99,7 +101,10 @@ pub fn builtin_object_values_all( pub fn builtin_object_keys_values_ex( o: ObjValue, include_hidden: bool, - #[cfg(feature = "exp-preserve-order")] preserve_order: bool, + + #[default(false)] + #[cfg(feature = "exp-preserve-order")] + preserve_order: bool, ) -> ArrValue { o.key_values_ex( include_hidden,