arranger: trying to fix conditional layers

This commit is contained in:
🪞👃🪞 2025-05-17 21:56:46 +03:00
parent 9fcb5a08c6
commit 01db41b75d
5 changed files with 24 additions and 17 deletions

View file

@ -435,7 +435,8 @@ impl Configuration {
return Err(format!("(e4) unexpected non-symbol {next:?}").into())
};
if let Some(Token { value: Value::Str(path), .. }) = exp.peek() {
let token = exp.peek();
if let Some(Token { value: Value::Str(path), .. }) = token {
let path = base.as_ref().parent().unwrap().join(unquote(path));
if !std::fs::exists(&path)? {
return Err(format!("(e5) not found: {path:?}").into())
@ -448,7 +449,11 @@ impl Configuration {
map.add_layer_if(
Box::new(move |state|{
let mut exp = exp.clone();
Context::get(state, &mut exp).unwrap_or(false)
let value = Context::get(state, &mut format!(":{cond}").as_str().into()).unwrap_or(false);
if value {
panic!("layer-if cond={cond:?} exp={exp:?} value={value:?}");
}
value
}),
keys
);