From 21c8e9b6c2ed9dac1b94a597820c5e46025a3a93 Mon Sep 17 00:00:00 2001 From: Lach Date: Wed, 26 Aug 2020 13:34:04 +0500 Subject: [PATCH] feat(evaluator): push frame for if condition --- crates/jrsonnet-evaluator/src/evaluate.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/jrsonnet-evaluator/src/evaluate.rs b/crates/jrsonnet-evaluator/src/evaluate.rs index 90c8a76b..6114d08a 100644 --- a/crates/jrsonnet-evaluator/src/evaluate.rs +++ b/crates/jrsonnet-evaluator/src/evaluate.rs @@ -589,9 +589,11 @@ pub fn evaluate(context: Context, expr: &LocExpr) -> Result { cond_then, cond_else, } => { - if evaluate(context.clone(), &cond.0)? - .try_cast_bool("if condition should be of type `boolean`")? - { + if push( + loc, + || "if condition".to_owned(), + || evaluate(context.clone(), &cond.0)?.try_cast_bool("in if condition"), + )? { evaluate(context, cond_then)? } else { match cond_else {