mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 19:28:13 +02:00
function references: make names of interface methods valid Pascal identifiers
On high level targets, and on PowerPC/PowerPC64, interface method thunks are implemented using internally-generated Pascal wrappers, so the method names need to be valid Pascal identifiers. Additionally, that wrapper code uses the procsym's realname, so also update the realname field when changing the name of anonymous methods.
This commit is contained in:
parent
29cfa3b225
commit
59f293711a
@ -883,7 +883,7 @@ implementation
|
||||
something like file position however as this might be inside
|
||||
an include file that's included multiple times }
|
||||
str(checkstack^.symtable.symlist.count,orgsp);
|
||||
orgsp:='_$Anonymous$'+orgsp;
|
||||
orgsp:='__FPCINTERNAL__Anonymous_'+orgsp;
|
||||
sp:=upper(orgsp);
|
||||
spnongen:=sp;
|
||||
orgspnongen:=orgsp;
|
||||
|
@ -915,7 +915,7 @@ implementation
|
||||
end;
|
||||
implintf:=capturedef.register_implemented_interface(result,true);
|
||||
|
||||
invokename:=method_name_funcref_invoke_decl+'$'+fileinfo_to_suffix(sym.fileinfo);
|
||||
invokename:=method_name_funcref_invoke_decl+'__FPCINTERNAL__'+fileinfo_to_suffix(sym.fileinfo);
|
||||
|
||||
ps:=cprocsym.create(invokename);
|
||||
pd:=tprocdef(tabstractprocdef(n.resultdef).getcopyas(procdef,pc_normal,'',false));
|
||||
@ -1130,7 +1130,7 @@ implementation
|
||||
end;
|
||||
implintf:=capturedef.register_implemented_interface(result,true);
|
||||
|
||||
invokename:=method_name_funcref_invoke_decl+'$'+fileinfo_to_suffix(pd.fileinfo);
|
||||
invokename:=method_name_funcref_invoke_decl+'__FPCINTERNAL__'+fileinfo_to_suffix(pd.fileinfo);
|
||||
if po_anonymous in pd.procoptions then
|
||||
begin
|
||||
{ turn the anonymous function into a method of the capturer }
|
||||
@ -1140,6 +1140,7 @@ implementation
|
||||
exclude(pd.procoptions,po_delphi_nested_cc);
|
||||
pd.was_anonymous:=true;
|
||||
pd.procsym.ChangeOwnerAndName(capturedef.symtable,upcase(invokename));
|
||||
pd.procsym.realname:=invokename;
|
||||
pd.parast.symtablelevel:=normal_function_level;
|
||||
pd.localst.symtablelevel:=normal_function_level;
|
||||
{ retrieve framepointer and self parameters if any }
|
||||
|
Loading…
Reference in New Issue
Block a user