Browse Source

+ introduced the is_wasm_reference_type(tdef) helper

Nikolay Nikolov 2 years ago
parent
commit
1f76366125
1 changed files with 8 additions and 0 deletions
  1. 8 0
      compiler/wasm32/symcpu.pas

+ 8 - 0
compiler/wasm32/symcpu.pas

@@ -211,6 +211,9 @@ const
   {# Returns true if p is a WebAssembly externref reference type }
   {# Returns true if p is a WebAssembly externref reference type }
   function is_wasm_externref(p : tdef): boolean;
   function is_wasm_externref(p : tdef): boolean;
 
 
+  {# Returns true if p is a WebAssembly reference type (funcref or externref) }
+  function is_wasm_reference_type(p : tdef): boolean;
+
 implementation
 implementation
 
 
   uses
   uses
@@ -233,6 +236,11 @@ implementation
       result:=(p.typ=pointerdef) and (tcpupointerdef(p).is_wasm_externref);
       result:=(p.typ=pointerdef) and (tcpupointerdef(p).is_wasm_externref);
     end;
     end;
 
 
+  function is_wasm_reference_type(p: tdef): boolean;
+    begin
+      result:=is_wasm_funcref(p) or is_wasm_externref(p);
+    end;
+
 
 
   {****************************************************************************
   {****************************************************************************
                                tcpuproptertysym
                                tcpuproptertysym