瀏覽代碼

+ add function to check whether a def is an invokable function reference

Sven/Sarah Barth 4 年之前
父節點
當前提交
122c6c92cb
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      compiler/defutil.pas

+ 9 - 0
compiler/defutil.pas

@@ -382,6 +382,9 @@ interface
     { returns true of def is a methodpointer }
     function is_methodpointer(def : tdef) : boolean;
 
+    { returns true if def is a function reference }
+    function is_funcref(def:tdef):boolean;
+
     { returns true if def is a C "block" }
     function is_block(def: tdef): boolean;
 
@@ -1894,6 +1897,12 @@ implementation
       end;
 
 
+    function is_funcref(def:tdef):boolean;
+      begin
+        result:=(def.typ=objectdef) and (oo_is_funcref in tobjectdef(def).objectoptions);
+      end;
+
+
     function is_block(def: tdef): boolean;
       begin
         result:=(def.typ=procvardef) and (po_is_block in tprocvardef(def).procoptions)