difftreelog
test fix build
in: master
2 files changed
bindings/jsonnet/src/val_modify.rsdiffbeforeafterboth1//! Modify VM values2//! Only tested with variables, which haven't altered by code before appearing here3//! In jrsonnet every value is immutable, and this code is probally broken45use std::{ffi::CStr, os::raw::c_char};67use jrsonnet_evaluator::{val::ArrValue, Thunk, Val};8use jrsonnet_gcmodule::Cc;910use crate::VM;1112/// Adds value to the end of the array `arr`.13///14/// # Safety15///16/// `arr` should be a pointer to array value allocated by make_array, or returned by other library call17/// `val` should be a pointer to value allocated using this library18#[no_mangle]19pub unsafe extern "C" fn jsonnet_json_array_append(_vm: &VM, arr: &mut Val, val: &Val) {20 match arr {21 Val::Arr(old) => {22 let mut new = Vec::new();23 for item in old.iter_lazy() {24 new.push(item);25 }2627 new.push(Thunk::evaluated(val.clone()));28 *arr = Val::Arr(ArrValue::lazy(Cc::new(new)));29 }30 _ => panic!("should receive array"),31 }32}3334/// Adds the field to the object, bound to value.35///36/// This shadows any previous binding of the field.37///38/// # Safety39///40/// `obj` should be a pointer to object value allocated by `make_object`, or returned by other library call41/// `name` should be NUL-terminated string42#[no_mangle]43pub unsafe extern "C" fn jsonnet_json_object_append(44 _vm: &VM,45 obj: &mut Val,46 name: *const c_char,47 val: &Val,48) {49 match obj {50 Val::Obj(old) => old51 .extend_field(CStr::from_ptr(name).to_str().unwrap().into())52 .value(val.clone()),53 _ => panic!("should receive object"),54 }55}1//! Modify VM values2//! Only tested with variables, which haven't altered by code before appearing here3//! In jrsonnet every value is immutable, and this code is probally broken45use std::{ffi::CStr, os::raw::c_char};67use jrsonnet_evaluator::{val::ArrValue, Thunk, Val};8use jrsonnet_gcmodule::Cc;910use crate::VM;1112/// Adds value to the end of the array `arr`.13///14/// # Safety15///16/// `arr` should be a pointer to array value allocated by make_array, or returned by other library call17/// `val` should be a pointer to value allocated using this library18#[no_mangle]19pub unsafe extern "C" fn jsonnet_json_array_append(_vm: &VM, arr: &mut Val, val: &Val) {20 match arr {21 Val::Arr(old) => {22 let mut new = Vec::new();23 for item in old.iter_lazy() {24 new.push(item);25 }2627 new.push(Thunk::evaluated(val.clone()));28 *arr = Val::Arr(ArrValue::lazy(new));29 }30 _ => panic!("should receive array"),31 }32}3334/// Adds the field to the object, bound to value.35///36/// This shadows any previous binding of the field.37///38/// # Safety39///40/// `obj` should be a pointer to object value allocated by `make_object`, or returned by other library call41/// `name` should be NUL-terminated string42#[no_mangle]43pub unsafe extern "C" fn jsonnet_json_object_append(44 _vm: &VM,45 obj: &mut Val,46 name: *const c_char,47 val: &Val,48) {49 match obj {50 Val::Obj(old) => old51 .extend_field(CStr::from_ptr(name).to_str().unwrap().into())52 .value(val.clone()),53 _ => panic!("should receive object"),54 }55}crates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth--- a/crates/jrsonnet-parser/src/lib.rs
+++ b/crates/jrsonnet-parser/src/lib.rs
@@ -635,9 +635,13 @@
el!(
Index {
indexable: el!(Var("std".into()), 1, 4),
- index: el!(Str("deepJoin".into()), 5, 13),
- #[cfg(feature = "exp-null-coaelse")]
- null_coaelse: false,
+ parts: vec![
+ IndexPart {
+ value: el!(Str("deepJoin".into()), 5, 13),
+ #[cfg(feature = "exp-null-coaelse")]
+ null_coaelse: false,
+ },
+ ],
},
1,
13