Browse Source

+ add utility function to check whether an objectdef is an invokable one

Sven/Sarah Barth 3 years ago
parent
commit
833a971877
1 changed files with 9 additions and 0 deletions
  1. 9 0
      compiler/defutil.pas

+ 9 - 0
compiler/defutil.pas

@@ -385,6 +385,9 @@ interface
     { returns true if def is a function reference }
     { returns true if def is a function reference }
     function is_funcref(def:tdef):boolean;
     function is_funcref(def:tdef):boolean;
 
 
+    { returns true if def is an invokable interface }
+    function is_invokable(def:tdef):boolean;
+
     { returns true if def is a C "block" }
     { returns true if def is a C "block" }
     function is_block(def: tdef): boolean;
     function is_block(def: tdef): boolean;
 
 
@@ -1903,6 +1906,12 @@ implementation
       end;
       end;
 
 
 
 
+    function is_invokable(def:tdef):boolean;
+      begin
+        result:=(def.typ=objectdef) and (oo_is_invokable in tobjectdef(def).objectoptions);
+      end;
+
+
     function is_block(def: tdef): boolean;
     function is_block(def: tdef): boolean;
       begin
       begin
         result:=(def.typ=procvardef) and (po_is_block in tprocvardef(def).procoptions)
         result:=(def.typ=procvardef) and (po_is_block in tprocvardef(def).procoptions)