M3: an effects key naming no effect's field binds nothing (#2055)

Review follow-up: `effects/x/radius`, `effects/0` and `effects` name no
effect's field, but `list_binding` doesn't parse them, so the layer's
check took them for some other field and kept an inert binding. A key
under `effects` that names no effect's field is now refused as well.
This commit is contained in:
Oleksii Sukholita
2026-11-06 20:18:10 +01:00
parent 104aa3deb1
commit d23cebb12f
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -661,11 +661,12 @@ fn effect_field(doc: &Document, node: NodeId, i: usize, field: &str) -> Option<V
}
/// Whether `node` has the field a binding key names. Only effect fields are checked: a layer has
/// `effects/<i>/<field>` when its effect `i` has that field (a drop shadow has no `refraction`).
/// `effects/<i>/<field>` when its effect `i` has that field (a drop shadow has no `refraction`),
/// and an `effects…` key naming no effect's field (`effects/x/radius`, `effects/0`) has none.
pub fn has_field(doc: &Document, node: NodeId, field: &str) -> bool {
match super::lists::list_binding(field) {
Some((BoundList::Effects, i, f)) => effect_field(doc, node, i, f).is_some(),
_ => true,
_ => field.split('/').next() != Some(BoundList::Effects.prefix()),
}
}