git.delta.rocks / jrsonnet / refs/commits / 11555dda9997

difftreelog

fix forward null-coaelse

Yaroslav Bolyukin2023-08-06parent: #ceb1d3e.patch.diff
in: master

4 files changed

modifiedcmds/jrsonnet/Cargo.tomldiffbeforeafterboth
before · cmds/jrsonnet/Cargo.toml
1[package]2name = "jrsonnet"3description = "Rust jsonnet implementation"4version.workspace = true5repository.workspace = true6authors = ["Yaroslav Bolyukin <iam@lach.pw>"]7license = "MIT"8edition = "2021"910[features]11experimental = ["exp-preserve-order", "exp-destruct", "exp-null-coaelse", "exp-object-iteration", "exp-bigint", "exp-apply"]12# Use mimalloc as allocator13mimalloc = ["mimallocator"]14# Experimental feature, which allows to preserve order of object fields15exp-preserve-order = [16    "jrsonnet-evaluator/exp-preserve-order",17    "jrsonnet-cli/exp-preserve-order",18]19# Destructuring of locals20exp-destruct = ["jrsonnet-evaluator/exp-destruct"]21# Iteration over objects yields [key, value] elements22exp-object-iteration = ["jrsonnet-evaluator/exp-object-iteration"]23# Bigint type24exp-bigint = ["jrsonnet-evaluator/exp-bigint", "jrsonnet-cli/exp-bigint"]25# obj?.field, obj?.['field']26exp-null-coaelse = ["jrsonnet-evaluator/exp-null-coaelse", "jrsonnet-parser/exp-null-coaelse"]27# --exp-apply28exp-apply = []2930# std.thisFile support31legacy-this-file = ["jrsonnet-cli/legacy-this-file"]3233nightly = ["jrsonnet-evaluator/nightly"]3435[dependencies]36jrsonnet-evaluator.workspace = true37jrsonnet-parser.workspace = true38jrsonnet-cli.workspace = true39jrsonnet-gcmodule.workspace = true4041mimallocator = { version = "0.1.3", optional = true }42thiserror = "1.0"43clap = { version = "4.1", features = ["derive"] }44clap_complete = { version = "4.1" }
modifiedcrates/jrsonnet-cli/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-cli/Cargo.toml
+++ b/crates/jrsonnet-cli/Cargo.toml
@@ -16,6 +16,10 @@
     "jrsonnet-evaluator/exp-bigint",
     "jrsonnet-stdlib/exp-bigint",
 ]
+exp-null-coaelse = [
+    "jrsonnet-evaluator/exp-null-coaelse",
+    "jrsonnet-stdlib/exp-null-coaelse",
+]
 legacy-this-file = ["jrsonnet-stdlib/legacy-this-file"]
 
 [dependencies]
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/mod.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/mod.rs
@@ -461,6 +461,10 @@
 				))
 			};
 			let Some(super_obj) = ctx.super_obj() else {
+				#[cfg(feature = "exp-null-coaelse")]
+				if *null_coaelse {
+					return Ok(Val::Null);
+				}
 				throw!(NoSuperFound)
 			};
 			let this = ctx
modifiedcrates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -19,6 +19,8 @@
 # Bigint type
 exp-bigint = ["num-bigint", "jrsonnet-evaluator/exp-bigint"]
 
+exp-null-coaelse = ["jrsonnet-parser/exp-null-coaelse", "jrsonnet-evaluator/exp-null-coaelse"]
+
 [dependencies]
 jrsonnet-evaluator.workspace = true
 jrsonnet-macros.workspace = true