Re: [fpc-pascal] Exploring block statements with CodeTools not working

2022-10-15 Thread Ondrej Pokorny via fpc-pascal
Am 16.10.2022 um 04:19 schrieb Hairy Pixels via fpc-pascal: Btw, I understand this question is basically for Mattias but I don’t know where else to post. Does Mattias prefer I post in one of these forums https://forum.lazarus.freepascal.org or maybe email privately with code tools questions?

[fpc-pascal] Exploring block statements with CodeTools not working

2022-10-15 Thread Hairy Pixels via fpc-pascal
I’m trying to look at the code in a the begin..end section of this sample program but for some reason when it gets to the BeginBlock node child count is always 0 (other nodes are as expected though). I’m calling Explore correctly I think so what could the problem be? Here is the little test pro

Re: [fpc-pascal] Open array compatibility

2022-10-15 Thread Hairy Pixels via fpc-pascal
> On Oct 15, 2022, at 3:58 PM, Michael Van Canneyt > wrote: > > One reason we do not allow descendents is that if you have a var array, the > returned value may contain classes of a type that the caller does not expect. > (This is the same reason why (var value: TObject) requires an exact matc

Re: [fpc-pascal] Open array compatibility

2022-10-15 Thread Michael Van Canneyt via fpc-pascal
On Sat, 15 Oct 2022, Hairy Pixels via fpc-pascal wrote: Another question I just ran in to. Why isn’t "array of TMyClass” compatible with “array of TObject” open array? TMyClass is a descendant of TObject and dynamic arrays are compatible with open arrays right? == type

[fpc-pascal] Open array compatibility

2022-10-15 Thread Hairy Pixels via fpc-pascal
Another question I just ran in to. Why isn’t "array of TMyClass” compatible with “array of TObject” open array? TMyClass is a descendant of TObject and dynamic arrays are compatible with open arrays right? == type TMyClass = class end; procedure MyProcedure(values: arra

Re: [fpc-pascal] Iterating over elements from GetDynArrayProp

2022-10-15 Thread Michael Van Canneyt via fpc-pascal
On Sat, 15 Oct 2022, Hairy Pixels wrote: On Oct 15, 2022, at 3:03 PM, Michael Van Canneyt wrote: as far as I kbow, this should be ObjectArray := TObjectArray(GetDynArrayProp(AObject, PropertyInfo)); i.e. you get the actual array as a result. You’re right, I didn’t need that pointer cas

Re: [fpc-pascal] Iterating over elements from GetDynArrayProp

2022-10-15 Thread Hairy Pixels via fpc-pascal
> On Oct 15, 2022, at 3:03 PM, Michael Van Canneyt > wrote: > > as far as I kbow, this should be > ObjectArray := TObjectArray(GetDynArrayProp(AObject, PropertyInfo)); > i.e. you get the actual array as a result. > You’re right, I didn’t need that pointer cast. I’m still curious though why

Re: [fpc-pascal] Iterating over elements from GetDynArrayProp

2022-10-15 Thread Michael Van Canneyt via fpc-pascal
On Sat, 15 Oct 2022, Hairy Pixels via fpc-pascal wrote: How can I iterate over the pointer that is returned from GetDynArrayProp? I tried to cast it as a dynamic array of the element type but calling Length() on the returned value gave garbled data. For example with a property of the type “