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

difftreelog

source

crates/jrsonnet-evaluator/src/tla.rs665 Bsourcehistory
1use std::{collections::HashMap, hash::BuildHasher};23use jrsonnet_interner::IStr;4use jrsonnet_parser::Source;56use crate::{7	function::{CallLocation, TlaArg},8	in_description_frame, with_state, Result, Val,9};1011pub fn apply_tla<H: BuildHasher>(args: &HashMap<IStr, TlaArg, H>, val: Val) -> Result<Val> {12	Ok(if let Val::Func(func) = val {13		in_description_frame(14			|| "during TLA call".to_owned(),15			|| {16				func.evaluate(17					with_state(|s| {18						s.create_default_context(Source::new_virtual(19							"<top-level-arg>".into(),20							IStr::empty(),21						))22					}),23					CallLocation::native(),24					args,25					false,26				)27			},28		)?29	} else {30		val31	})32}