Fix a bug I found while fixing the bug fixed in previous commit

This bug was that using a math assignment operator was allowed by fiat.
This fixes that and adds a test for it.

Signed-off-by: Gavin Howard <[email protected]>
This commit is contained in:
Gavin Howard 2021-07-25 08:38:17 -06:00
parent f46644247f
commit f22634b318
Signed by: gavin
GPG Key ID: C08038BDF280D33E
2 changed files with 6 additions and 0 deletions

View File

@ -1274,6 +1274,11 @@ static void bc_program_assign(BcProgram *p, uchar inst) {
// Get the location of the string.
BcLoc loc = bc_program_stringLoc(right, r);
#if BC_ENABLED
if (inst != BC_INST_ASSIGN && inst != BC_INST_ASSIGN_NO_VAL)
bc_err(BC_ERR_EXEC_TYPE);
#endif // BC_ENABLED
// If we are assigning to an array element...
if (left->t == BC_RESULT_ARRAY_ELEM) {

View File

@ -242,6 +242,7 @@ abs("string")
abs(a[])
scale("string")
v = "s"; scale(v)
v += "string"
scale(b[])
sqrt("string")
sqrt(c[])