[fpc-devel] class-attributes
Joost van der Sluis
joost at cnoc.nl
Thu May 24 20:07:19 CEST 2012
On Thu, 2012-05-24 at 18:48 +0200, Sven Barth wrote:
> On 24.05.2012 15:27, Joost van der Sluis wrote:
> > On 17 May 2012, at 23:32, Joost van der Sluis wrote:
> > 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?
> * 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
Ok, I'll change that.
> * 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)
I'll will look what Delphi does. In principle i don't a reason why it
shouldn't work.
> * in generate_rttiattribute_procs_properties you also need to handle
> nested classes
Ah yes, offcourse. I will also look at the 'normal' rtti generation, I
copied the code from there. Maybe that there is no rtti information
generated for nested classes at all at this moment.
> * 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?)
See the second change in pdecobj. (In procedure truct_property_dec)
> And two questions:
> * does the usage of attributes with methods/fields depend on the
> availability of the extended RTTI?
Yes. Without extended RTTI you can not get a list of method/fields at
runtime. So where should the attributes be bound to?
> * can attributes also be used with records in Delphi? (as they can now
> carry properties as well)
I don't know. Do we support rtti on records? I think this is also a part
of what Delphi calls 'extended rtti'.
Joost
More information about the fpc-devel
mailing list