git.delta.rocks / jrsonnet / refs/commits / 57f3c8960257

difftreelog

feat add field access to stack

Лач2020-07-22parent: #8c5f44d.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
819 evaluate(context, index)?,819 evaluate(context, index)?,
820 ) {820 ) {
821 (Val::Obj(v), Val::Str(s)) => {821 (Val::Obj(v), Val::Str(s)) => {
822 let sn = s.clone();
823 push(
824 &loc,
825 || format!("field <{}> access", sn),
826 || {
822 if let Some(v) = v.get(s.clone())? {827 if let Some(v) = v.get(s.clone())? {
828 println!("{:?}", loc);
823 v.unwrap_if_lazy()?829 Ok(v.unwrap_if_lazy()?)
824 } else if let Some(Val::Str(n)) = v.get("__intristic_namespace__".into())? {830 } else if let Some(Val::Str(n)) =
831 v.get("__intristic_namespace__".into())?
832 {
825 Val::Intristic(n, s)833 Ok(Val::Intristic(n, s))
826 } else {834 } else {
827 throw!(NoSuchField(s))835 throw!(NoSuchField(s))
828 }836 }
837 },
838 )?
829 }839 }
830 (Val::Obj(_), n) => throw!(ValueIndexMustBeTypeGot(840 (Val::Obj(_), n) => throw!(ValueIndexMustBeTypeGot(
831 ValType::Obj,841 ValType::Obj,