git.delta.rocks / jrsonnet / refs/commits / 11dc48e90ac0

difftreelog

fix experimental build

Yaroslav Bolyukin2024-05-01parent: #f0883bb.patch.diff
in: master

4 files changed

modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -110,10 +110,7 @@
 						fn get(self: Box<Self>) -> Result<Self::Output> {
 							let full = self.full.evaluate()?;
 							let to = full.len() - self.end;
-							Ok(Val::Arr(
-								full.slice(Some(self.start), Some(to), None)
-									.expect("arguments checked"),
-							))
+							Ok(Val::Arr(full.slice(Some(self.start as i32), Some(to as i32), None)))
 						}
 					}
 
modifiedcrates/jrsonnet-stdlib/src/manifest/mod.rsdiffbeforeafterboth
10};10};
11pub use python::{PythonFormat, PythonVarsFormat};11pub use python::{PythonFormat, PythonVarsFormat};
12pub use toml::TomlFormat;12pub use toml::TomlFormat;
13pub use yaml::YamlFormat;13pub use xml::XmlJsonmlFormat;
14pub use xml::XmlJsonmlFormat;14pub use yaml::YamlFormat;
1515
16#[builtin]16#[builtin]
17pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {17pub fn builtin_escape_string_json(str_: IStr) -> Result<String> {
151151
152#[builtin]152#[builtin]
153pub fn builtin_manifest_python(v: Val) -> Result<String> {153pub fn builtin_manifest_python(
154 v: Val,
155
156 #[default(false)]
157 #[cfg(feature = "exp-preserve-order")]
158 preserve_order: bool,
159) -> Result<String> {
154 v.manifest(PythonFormat {})160 v.manifest(PythonFormat::std(
161 #[cfg(feature = "exp-preserve-order")]
162 preserve_order,
163 ))
155}164}
156#[builtin]165#[builtin]
157pub fn builtin_manifest_python_vars(v: Val) -> Result<String> {166pub fn builtin_manifest_python_vars(
167 v: Val,
168
169 #[default(false)]
170 #[cfg(feature = "exp-preserve-order")]
171 preserve_order: bool,
172) -> Result<String> {
158 v.manifest(PythonVarsFormat {})173 v.manifest(PythonVarsFormat::std(
174 #[cfg(feature = "exp-preserve-order")]
175 preserve_order,
176 ))
159}177}
160178
161#[builtin]179#[builtin]
modifiedcrates/jrsonnet-stdlib/src/manifest/python.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/python.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/python.rs
@@ -9,6 +9,15 @@
 	preserve_order: bool,
 }
 
+impl PythonFormat {
+	pub fn std(#[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> Self {
+		Self {
+			#[cfg(feature = "exp-preserve-order")]
+			preserve_order,
+		}
+	}
+}
+
 impl ManifestFormat for PythonFormat {
 	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {
 		match val {
@@ -17,6 +26,8 @@
 			Val::Null => buf.push_str("None"),
 			Val::Str(s) => escape_string_json_buf(&s.to_string(), buf),
 			Val::Num(_) => ToStringFormat.manifest_buf(val, buf)?,
+			#[cfg(feature = "exp-bigint")]
+			Val::BigInt(_) => ToStringFormat.manifest_buf(val, buf)?,
 			Val::Arr(arr) => {
 				buf.push('[');
 				for (i, el) in arr.iter().enumerate() {
@@ -57,7 +68,14 @@
 	preserve_order: bool,
 }
 
-impl PythonVarsFormat {}
+impl PythonVarsFormat {
+	pub fn std(#[cfg(feature = "exp-preserve-order")] preserve_order: bool) -> Self {
+		Self {
+			#[cfg(feature = "exp-preserve-order")]
+			preserve_order,
+		}
+	}
+}
 
 impl ManifestFormat for PythonVarsFormat {
 	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {
modifiedcrates/jrsonnet-stdlib/src/manifest/xml.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/manifest/xml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/xml.rs
@@ -95,7 +95,11 @@
 			buf.push('<');
 			buf.push_str(&tag);
 			attrs.run_assertions()?;
-			for (key, value) in attrs.iter() {
+			for (key, value) in attrs.iter(
+				// Not much sense to preserve order here
+				#[cfg(feature = "exp-preserve-order")]
+				false,
+			) {
 				buf.push(' ');
 				buf.push_str(&key);
 				buf.push('=');