* Propagate delphi mode when scanning generated code for wasm (specially generic specialization)

This commit is contained in:
Michaël Van Canneyt 2025-05-20 11:40:58 +02:00
parent fdc19ea051
commit 37b3a88fa0

View File

@ -1525,8 +1525,12 @@ implementation
begin
cn:=ObjDef.GetTypeName;
for i:=0 to Length(cn) do
begin
if cn[i]='.' then
cn[i]:='_'
else if (cn[i]='<') or (cn[i]='>') then
cn[i]:='_';
end;
result:='_t_hidden'+tostr(acount)+cn;
end;
@ -1815,14 +1819,22 @@ implementation
recdef : trecorddef absolute def;
sstate: tscannerstate;
cn : shortstring;
isDelphiMode : boolean;
oldsettings: tmodeswitches;
begin
{ skip if any errors have occurred, since then this can only cause more
errors }
if ErrorCount<>0 then
exit;
isDelphiMode:=(m_delphi in current_settings.modeswitches);
replace_scanner('hiddenclass_impl',sstate);
sstate.new_scanner.allowgenericid:=true;
if isDelphiMode then
begin
oldsettings:=current_settings.modeswitches;
current_settings.modeswitches:=current_settings.modeswitches+[m_delphi]-[m_objfpc];
end;
for i:=0 to st.deflist.count-1 do
begin
def:=tdef(st.deflist[i]);