[fpc-devel] class-attributes

Sven Barth pascaldragon at googlemail.com
Thu May 24 18:48:04 CEST 2012


On 24.05.2012 15:27, Joost van der Sluis wrote:
> On 17 May 2012, at 23:32, Joost van der Sluis wrote:
>
>>> I'm trying to implement extended RTTI property attributes as
>>> supported by recent Delphi versions.
>
>>> Please add this functionality first to a separate branch for easier
>>> reviewing.
>
> I could, but I attached a patch first. Before I commit this to a branch
> I want to know that I'm on the right track. Could you and/or others have
> a look at the patch?
>
> I'm especially interested if things are done in the right units, and if
> the code in ptypes.pas is acceptable.
>
> Attached are the patch and a simple test-program.

Some small remarks that I noticed:

* please call your "generate_rttiattribute_procs" after the 
"generate_specialization_procs" as methods of generics could force the 
specialization of a class that is not yet specialized, but that carries 
attributes
* maybe it's better not to generate attribute data for generics, I don't 
know... (simply check for "df_generic in ttypesym(p).typedef.defoptions" 
in generate_rttiattribute_procs_classes)
* in generate_rttiattribute_procs_properties you also need to handle 
nested classes
* you should increase the PPU version in ppu.pas as you added a new field
* you might want to call me blind, but where did you add the field 
rtti_attributesdef to, to which you assign the current_rttiattributedef? 
(can it be that you forgot that in the patch?)

And two questions:
* does the usage of attributes with methods/fields depend on the 
availability of the extended RTTI?
* can attributes also be used with records in Delphi? (as they can now 
carry properties as well)

Regards,
Sven



More information about the fpc-devel mailing list