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
--- a/cmds/jrsonnet/Cargo.toml
+++ b/cmds/jrsonnet/Cargo.toml
@@ -23,7 +23,7 @@
 # Bigint type
 exp-bigint = ["jrsonnet-evaluator/exp-bigint", "jrsonnet-cli/exp-bigint"]
 # obj?.field, obj?.['field']
-exp-null-coaelse = ["jrsonnet-evaluator/exp-null-coaelse", "jrsonnet-parser/exp-null-coaelse"]
+exp-null-coaelse = ["jrsonnet-evaluator/exp-null-coaelse", "jrsonnet-parser/exp-null-coaelse", "jrsonnet-cli/exp-null-coaelse"]
 # --exp-apply
 exp-apply = []
 
modifiedcrates/jrsonnet-cli/Cargo.tomldiffbeforeafterboth
before · crates/jrsonnet-cli/Cargo.toml
1[package]2name = "jrsonnet-cli"3description = "Utilities for building jrsonnet CLIs"4version.workspace = true5repository.workspace = true6authors = ["Yaroslav Bolyukin <iam@lach.pw>"]7license = "MIT"8edition = "2021"910[features]11exp-preserve-order = [12    "jrsonnet-evaluator/exp-preserve-order",13    "jrsonnet-stdlib/exp-preserve-order",14]15exp-bigint = [16    "jrsonnet-evaluator/exp-bigint",17    "jrsonnet-stdlib/exp-bigint",18]19legacy-this-file = ["jrsonnet-stdlib/legacy-this-file"]2021[dependencies]22jrsonnet-evaluator = { workspace = true, features = ["explaining-traces"] }23jrsonnet-parser.workspace = true24jrsonnet-stdlib.workspace = true25jrsonnet-gcmodule.workspace = true2627clap = { version = "4.1", features = ["derive"] }
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