&list := {
&foo[1] = "bar"
}
The edit code does not support this, because it doesn't really
make a lot of sense. If we do need to support it, then the edit
code needs to be updated to support it.
Note that we can already do
&list.foo[1] = "bar"
so this limitation isn't much of an issue. The problem comes when
doing multiple attribute assignments, and those using array indexes
inside of a sublist. What does it mean when we do
&list := {
&foo[0] = "bar"
&foo[1] = "baz"
&foo[0] = "ugh"
}
What the heck is going on here? The real answer is "don't do that"
*/
parent_da = tmpl_da(map->lhs);
if (fr_type_is_structural(parent_da->type)) {
+ map_t *child;
+
if (map_afrom_cs(map, &map->child, cs, &t_rules, &t_rules, unlang_fixup_edit, map, 256) < 0) {
goto fail;
}
+
+ /*
+ * As a set of fixups... we can't do array references in -=
+ */
+ for (child = map_list_head(&map->child); child != NULL; child = map_list_next(&map->child, child)) {
+ if (!tmpl_is_attr(child->lhs)) continue;
+
+ if (tmpl_num(child->lhs) != NUM_UNSPEC) {
+ cf_log_err(child->ci, "Cannot use array references and values when deleting from a list");
+ goto fail;
+ }
+ }
} else {
/*
* &foo := { a, b, c }