Browse Source

* Add codeaddress to extended RTTI for static methods

Michaël Van Canneyt 1 year ago
parent
commit
4769ed948a
2 changed files with 10 additions and 1 deletions
  1. 3 1
      compiler/ncgrtti.pas
  2. 7 0
      rtl/objpas/typinfo.pp

+ 3 - 1
compiler/ncgrtti.pas

@@ -322,7 +322,9 @@ implementation
                           begin
                             maybe_add_comment(tcb,#9'VMT index');
                             tcb.emit_ord_const(def.extnumber,u16inttype);
-                          end;
+                            maybe_add_comment(tcb,#9'Code Address');
+                            tcb.emit_procdef_const(def);
+                          end
                       end;
 
                     for k:=0 to def.paras.count-1 do

+ 7 - 0
rtl/objpas/typinfo.pp

@@ -505,6 +505,9 @@ unit TypInfo;
         NamePtr: PShortString;
         Flags: Byte;
         VmtIndex: Smallint;
+        {$IFNDEF VER3_2}
+        CodeAddress : CodePointer;
+        {$ENDIF}
         property Name: ShortString read GetName;
         property Param[Index: Word]: PVmtMethodParam read GetParam;
         property ResultLocs: PParameterLocations read GetResultLocs;
@@ -4650,7 +4653,11 @@ var
 
 begin
   if ParamCount = 0 then
+{$IFNDEF VER3_2}
+    Result := PByte(@CodeAddress) + SizeOf(CodePointer)
+{$ELSE}
     Result := PByte(@VmtIndex) + SizeOf(VmtIndex)
+{$ENDIF}
   else
     Result:=Param[ParamCount-1]^.GetTail;
   if Assigned(ResultType) then