FPC creates PropInfo for enumerated types with jumps
Summary
FPC creates PropInfo for enumerated types with jumps. It should not because this kind of enum doesn't have RTTI.
Example Project
program RTTITest;
{$ifdef DCC}
// Delphi
{$APPTYPE CONSOLE}
{$else}
// FPC
{$mode delphi}{$h+}
{$endif}
uses
SysUtils, Classes, TypInfo;
type
TFruitMore = (fmApple=1, fmOrange=3, fmBanana=5, fmGrapes, fmPear);
TMyClass = class(TPersistent)
private
FFruit: TFruitMore;
Published
property Fruit : TFruitMore Read FFruit Write FFruit;
end;
var
PI : PPropInfo;
aClass : TMyClass;
TypeData : PTypeData;
begin
aClass:=TMyClass.Create;
TypeData:=GetTypeData(aClass.ClassInfo);
Writeln('PropCount: ', TypeData^.PropCount); // Delphi writes 0, FPC writes 1
PI:=GetPropInfo(aClass,'Fruit',tkAny);
if PI=nil then
Writeln('Property info is null')
else
begin
Writeln('Property name: ', PI^.Name);
Writeln('Property kind: ', GetEnumName(TypeInfo(TTypeKind), Ord(PI^.PropType^.Kind)));
end;
Readln;
end.
Edited by Ondrej Pokorny