Skip to content

Commit

Permalink
feat(evaluator): push frame for if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
CertainLach committed Aug 26, 2020
1 parent 0bd0b86 commit 21c8e9b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/jrsonnet-evaluator/src/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,11 @@ pub fn evaluate(context: Context, expr: &LocExpr) -> Result<Val> {
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 {
Expand Down

0 comments on commit 21c8e9b

Please sign in to comment.