* apply part of patch by Blaise.ru: check only once whether writable consts are enabled or not by determining the type of the assembly list earlier (it's only not needed in an error case anyway)

This commit is contained in:
Sven/Sarah Barth 2022-01-06 18:29:13 +01:00
parent e5ac99a4c9
commit bd226c00f1

View File

@ -229,8 +229,8 @@ implementation
first, first,
isgeneric, isgeneric,
skipequal : boolean; skipequal : boolean;
tclist : tasmlist;
varspez : tvarspez; varspez : tvarspez;
asmtype : tasmlisttype;
begin begin
old_block_type:=block_type; old_block_type:=block_type;
block_type:=bt_const; block_type:=bt_const;
@ -293,9 +293,15 @@ implementation
storetokenpos:=current_tokenpos; storetokenpos:=current_tokenpos;
current_tokenpos:=filepos; current_tokenpos:=filepos;
if not (cs_typed_const_writable in current_settings.localswitches) then if not (cs_typed_const_writable in current_settings.localswitches) then
varspez:=vs_const begin
varspez:=vs_const;
asmtype:=al_rotypedconsts;
end
else else
varspez:=vs_value; begin
varspez:=vs_value;
asmtype:=al_typedconsts;
end;
{ if we are dealing with structure const then we need to handle it as a { if we are dealing with structure const then we need to handle it as a
structure static variable: create a symbol in unit symtable and a reference structure static variable: create a symbol in unit symtable and a reference
to it from the structure or linking will fail } to it from the structure or linking will fail }
@ -344,11 +350,7 @@ implementation
begin begin
{ get init value } { get init value }
consume(_EQ); consume(_EQ);
if (cs_typed_const_writable in current_settings.localswitches) then read_typed_const(current_asmdata.asmlists[asmtype],tstaticvarsym(sym),in_structure);
tclist:=current_asmdata.asmlists[al_typedconsts]
else
tclist:=current_asmdata.asmlists[al_rotypedconsts];
read_typed_const(tclist,tstaticvarsym(sym),in_structure);
end; end;
end; end;