Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-02

Does RTTI offer any method parameter information?

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Howard Page-Clark

In a situation where

PPropInfo^.PropType^.Kind=tkMethod

does RTTI enable you to determine the number and/or types of the parameters that method uses (if any)?
If not, is there a programmatic way to determine that information apart from parsing the source?

Howard

Sven Barth
to Howard Page-Clark
Howard Page-Clark wrote 6 lines
In a situation where PPropInfo^.PropType^.Kind=tkMethod does RTTI enable you to determine the number and/or types of the parameters that method uses (if any)?

Yes, please take a look at the tkMethod part of the case inside TTypeData in $fpcdir/rtl/objpas/typinfo.pp
There are AFAIK no functions yet that simplify the access though. Maybe someone else has already written a wrapper for it.

Regards,
Sven

Howard Page-Clark
to Sven Barth
Sven Barth wrote 12 lines
On 01.02.2014 19:10, Howard Page-Clark wrote: > In a situation where > > PPropInfo^.PropType^.Kind=tkMethod > > does RTTI enable you to determine the number and/or types of the > parameters that method uses (if any)? Yes, please take a look at the tkMethod part of the case inside TTypeData in $fpcdir/rtl/objpas/typinfo.pp There are AFAIK no functions yet that simplify the access though. Maybe someone else has already written a wrapper for it.

I should have known to look at the source. Thanks Sven for pointing me to the correct place.

H

Sven Barth
to Howard Page-Clark
Howard Page-Clark wrote 16 lines
On 01/02/2014 18:54, Sven Barth wrote: > On 01.02.2014 19:10, Howard Page-Clark wrote: >> In a situation where >> >> PPropInfo^.PropType^.Kind=tkMethod >> >> does RTTI enable you to determine the number and/or types of the >> parameters that method uses (if any)? > > Yes, please take a look at the tkMethod part of the case inside > TTypeData in $fpcdir/rtl/objpas/typinfo.pp > There are AFAIK no functions yet that simplify the access though. Maybe > someone else has already written a wrapper for it. I should have known to look at the source. Thanks Sven for pointing me to the correct place.

You're welcome. For RTTI the two most reliable sources are the typinfo.pp unit and the compiler's ncgrtti.pas. ;)

Regards,
Sven