Don't overwrite symbol when it's not allowed

When a user tried to overwrite a builtin symbol, it would change its
type despite the error, making the second try succeed. This is
problematic, as the location of a builtin symbol cannot be updated.
This commit is contained in:
Jakub Kądziołka
2020-10-12 12:27:06 +02:00
parent 71d8aeb4c2
commit b07aa00d5c
4 changed files with 8 additions and 0 deletions

View File

@@ -426,6 +426,7 @@ struct Symbol *sym_AddSet(char const *symName, int32_t value)
symName, sym->type == SYM_LABEL ? "label" : "constant");
dumpFilename(sym);
putc('\n', stderr);
return sym;
} else {
/* TODO: can the scope be incorrect when taking over refs? */
updateSymbolFilename(sym);