+ introduced is_wasm_funcref(tdef) helper

This commit is contained in:
Nikolay Nikolov 2023-06-05 04:51:03 +03:00
parent dd09bf64b3
commit 022d2804a9
2 changed files with 9 additions and 2 deletions

View File

@ -205,6 +205,8 @@ type
const
pbestrealtype : ^tdef = @s64floattype;
{# Returns true if p is a WebAssembly funcref reference type }
function is_wasm_funcref(p : tdef): boolean;
implementation
@ -218,6 +220,11 @@ implementation
tgcpu
;
function is_wasm_funcref(p: tdef): boolean;
begin
result:=(p.typ=procvardef) and (po_wasm_funcref in tprocvardef(p).procoptions);
end;
{****************************************************************************
tcpuproptertysym
@ -289,7 +296,7 @@ implementation
for i:=0 to pd.paras.Count-1 do
begin
prm := tcpuparavarsym(pd.paras[i]);
if (prm.vardef.typ=procvardef) and (po_wasm_funcref in tprocvardef(prm.vardef).procoptions) then
if is_wasm_funcref(prm.vardef) then
result.add_param(wbt_funcref)
else if (prm.vardef.typ=pointerdef) and (tcpupointerdef(prm.vardef).is_wasm_externref) then
result.add_param(wbt_externref)

View File

@ -105,7 +105,7 @@ unit tgcpu;
if not Result then
Exit;
if (def.typ=procvardef) and (po_wasm_funcref in tprocvardef(def).procoptions) then
if is_wasm_funcref(def) then
wbt := wbt_funcref
else if (def.typ=pointerdef) and (tcpupointerdef(def).is_wasm_externref) then
wbt := wbt_externref