Просмотр исходного кода

Switch procedure parameters and result type to indirect RTTI references.

compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data.procvardef_rtti:
  * write_procedure_param: use indirect RTTI reference
  * write result info for both methods and procvars as indirect RTTI reference
  * write parameters for procvars as indirect RTTI reference

rtl/objpas/typinfo.pp:
  * TProcedureParam: change type of ParamType to PPTypeInfo (no backwards compatiblity needed here; was added for 2.7.1)
  * TProcedureSignature: change type of RseultType to PPTypeInfo (no backwards compatibility needed here; was added for 2.7.1)
  * TTypeData: remark in the comments of tkMethod that ResultTypeRef and ParamTypeRefs are of type PPTypeInfo and not PTypeInfo

tests/test/trtti9.pp: 
  * fix test

git-svn-id: branches/svenbarth/packages@28293 -
svenbarth 11 лет назад
Родитель
Сommit
8058aae24f
3 измененных файлов с 9 добавлено и 9 удалено
  1. 4 4
      compiler/ncgrtti.pas
  2. 4 4
      rtl/objpas/typinfo.pp
  3. 1 1
      tests/test/trtti9.pp

+ 4 - 4
compiler/ncgrtti.pas

@@ -759,7 +759,7 @@ implementation
                    write_param_flag(parasym);
                    maybe_write_align;
                    { write param type }
-                   write_rtti_reference(parasym.vardef,fullrtti);
+                   write_rtti_reference(parasym.vardef,fullrtti,true);
                    { write name of current parameter }
                    write_string(parasym.realname);
                  end;
@@ -815,7 +815,7 @@ implementation
                  write_rtti_name(def.returndef);
                  maybe_write_align;
                  { write result typeinfo }
-                 write_rtti_reference(def.returndef,fullrtti);
+                 write_rtti_reference(def.returndef,fullrtti,true);
                end;
 
                { write calling convention }
@@ -825,7 +825,7 @@ implementation
                { write params typeinfo }
                for i:=0 to def.paras.count-1 do
                  if not(vo_is_hidden_para in tparavarsym(def.paras[i]).varoptions) then
-                   write_rtti_reference(tparavarsym(def.paras[i]).vardef,fullrtti);
+                   write_rtti_reference(tparavarsym(def.paras[i]).vardef,fullrtti,true);
             end
           else
             begin
@@ -839,7 +839,7 @@ implementation
               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(ProcCallOptionToCallConv[def.proccalloption]));
               maybe_write_align;
               { write result typeinfo }
-              write_rtti_reference(def.returndef,fullrtti);
+              write_rtti_reference(def.returndef,fullrtti,true);
               { write parameter count }
               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(def.maxparacount));
               for i:=0 to def.paras.count-1 do

+ 4 - 4
rtl/objpas/typinfo.pp

@@ -151,7 +151,7 @@ unit typinfo;
       {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
       record
         Flags: Byte;
-        ParamType: PTypeInfo;
+        ParamType: PPTypeInfo;
         Name: ShortString;
       end;
 
@@ -162,7 +162,7 @@ unit typinfo;
       record
         Flags: Byte;
         CC: TCallConv;
-        ResultType: PTypeInfo;
+        ResultType: PPTypeInfo;
         ParamCount: Byte;
         {Params: array[0..ParamCount - 1] of TProcedureParam;}
         function GetParam(ParamIndex: Integer): PProcedureParam;
@@ -267,9 +267,9 @@ unit typinfo;
                   end;
               followed by
                   ResultType : ShortString     // for mkFunction, mkClassFunction only
-                  ResultTypeRef : PTypeInfo;  // for mkFunction, mkClassFunction only
+                  ResultTypeRef : PPTypeInfo;  // for mkFunction, mkClassFunction only
                   CC : TCallConv;
-                  ParamTypeRefs : array[1..ParamCount] of PTypeInfo;}
+                  ParamTypeRefs : array[1..ParamCount] of PPTypeInfo;}
               );
             tkProcVar:
               (ProcSig: TProcedureSignature);

+ 1 - 1
tests/test/trtti9.pp

@@ -11,7 +11,7 @@ type
 
 function TestParam(Param: PProcedureParam; Flags: TParamFlags; ParamType: Pointer; Name: ShortString): Boolean;
 begin
-  Result := (Param^.Flags = PByte(@Flags)^) and (Param^.ParamType = ParamType) and (Param^.Name = Name);
+  Result := (Param^.Flags = PByte(@Flags)^) and (Param^.ParamType^ = ParamType) and (Param^.Name = Name);
 end;
 
 var