* adjust handle_calling_convention so that it can be used with both proc(var)defs and invokables

This commit is contained in:
Sven/Sarah Barth 2022-01-27 22:38:07 +01:00
parent c92e290d67
commit 39f5534969
2 changed files with 14 additions and 5 deletions

View File

@ -3436,7 +3436,7 @@ const
pdflags : tpdflags;
pd : tabstractprocdef;
begin
if is_invokable(pd_or_invkdef) then
if is_funcref(pd_or_invkdef) then
pd:=get_invoke_procdef(tobjectdef(pd_or_invkdef))
else if pd_or_invkdef.typ=procvardef then
pd:=tprocvardef(pd_or_invkdef)

View File

@ -26,7 +26,7 @@ unit pparautl;
interface
uses
symconst,symdef;
symtype,symconst,symdef;
procedure insert_funcret_para(pd:tabstractprocdef);
procedure insert_parentfp_para(pd:tabstractprocdef);
@ -52,7 +52,8 @@ interface
hcc_default_actions_parse=[hcc_check,hcc_insert_hidden_paras];
PD_VIRTUAL_MUTEXCLPO = [po_interrupt,po_exports,po_overridingmethod,po_inline,po_staticmethod];
procedure handle_calling_convention(pd:tabstractprocdef;flags:thccflags);
{ may take procdef, procvardef or defs for which is_funcref is true }
procedure handle_calling_convention(pd_or_invkdef:tdef;flags:thccflags);
function proc_add_definition(var currpd:tprocdef):boolean;
{ create "parent frame pointer" record skeleton for procdef, in which local
@ -65,7 +66,7 @@ implementation
uses
globals,globtype,cclasses,cutils,verbose,systems,fmodule,
tokens,
symtype,symbase,symsym,symtable,symutil,defutil,defcmp,blockutl,
symbase,symsym,symtable,symutil,defutil,defcmp,blockutl,
{$ifdef jvm}
jvmdef,
{$endif jvm}
@ -505,8 +506,16 @@ implementation
end;
procedure handle_calling_convention(pd:tabstractprocdef;flags:thccflags);
procedure handle_calling_convention(pd_or_invkdef:tdef;flags:thccflags);
var
pd : tabstractprocdef;
begin
if is_funcref(pd_or_invkdef) then
pd:=get_invoke_procdef(tobjectdef(pd_or_invkdef))
else if pd_or_invkdef.typ in [procdef,procvardef] then
pd:=tabstractprocdef(pd_or_invkdef)
else
internalerror(2022012502);
if hcc_check in flags then
begin
{ set the default calling convention if none provided }