else
value = "";
+ /* Do some lexical error checking on the LHS and RHS of the assignment
+ that is specific to nameref variables. */
+ if (flags_on & att_nameref)
+ {
+ if (valid_array_reference (name))
+ {
+ builtin_error (_("%s: reference variable cannot be an array"), name);
+ assign_error++;
+ NEXT_VARIABLE ();
+ }
+ else if (STREQ (name, value))
+ {
+ builtin_error (_("%s: nameref variable self references not allowed"), name);
+ assign_error++;
+ NEXT_VARIABLE ();
+ }
+ }
+
#if defined (ARRAY_VARS)
compound_array_assign = simple_array_assign = 0;
subscript_start = (char *)NULL;
VSETATTR (var, att_invisible);
}
}
+ /* Can't take an existing array variable and make it a nameref */
+ else if ((array_p (var) || assoc_p (var)) && (flags_on & att_nameref))
+ {
+ builtin_error (_("%s: reference variable cannot be an array"), name);
+ assign_error++;
+ NEXT_VARIABLE ();
+ }
/* Cannot use declare +r to turn off readonly attribute. */
if (readonly_p (var) && (flags_off & att_readonly))