git.delta.rocks / jrsonnet / refs/commits / a31a8ef0c018

difftreelog

fix rename variable to local

Yaroslav Bolyukin2024-08-30parent: #761e429.patch.diff
in: master

2 files changed

modifiedcrates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -24,7 +24,12 @@
 		return String::new();
 	}
 	let mut out = String::new();
-	out.push_str("\nThere is ");
+	out.push_str("\nThere ");
+	if list.len() > 1 {
+		out.push_str("are ");
+	} else {
+		out.push_str("is a ");
+	}
 	out.push_str(what);
 	if list.len() > 1 {
 		out.push('s');
@@ -133,7 +138,7 @@
 	#[error("assert failed: {}", format_empty_str(.0))]
 	AssertionFailed(IStr),
 
-	#[error("variable is not defined: {0}{}", format_found(.1, "variable"))]
+	#[error("local is not defined: {0}{}", format_found(.1, "local"))]
 	VariableIsNotDefined(IStr, Vec<IStr>),
 	#[error("duplicate local var: {0}")]
 	DuplicateLocalVar(IStr),
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
464 UnaryOp(o, v) => evaluate_unary_op(*o, &evaluate(ctx, v)?)?,464 UnaryOp(o, v) => evaluate_unary_op(*o, &evaluate(ctx, v)?)?,
465 Var(name) => in_frame(465 Var(name) => in_frame(
466 CallLocation::new(&loc),466 CallLocation::new(&loc),
467 || format!("variable <{name}> access"),467 || format!("local <{name}> access"),
468 || ctx.binding(name.clone())?.evaluate(),468 || ctx.binding(name.clone())?.evaluate(),
469 )?,469 )?,
470 Index { indexable, parts } => ensure_sufficient_stack(|| {470 Index { indexable, parts } => ensure_sufficient_stack(|| {