[fpc-devel] "helper" feature finished

Sven Barth pascaldragon at googlemail.com
Tue Apr 12 21:41:49 CEST 2011


On 11.04.2011 01:33, Jonas Maebe wrote:
>
> On 10 Apr 2011, at 21:49, Florian Klämpfl wrote:
>
>> Am 08.04.2011 09:07, schrieb Jonas Maebe:
>>>
>>> On 08 Apr 2011, at 08:58, Sven Barth wrote:
>>>
>>> Maybe you can do it in pass_1 instead, and add another boolean field
>>> to ttypenode similar to allowed (such as classhelper_allowed). Then
>>> you can set this "allowed" to true from the typecheck pass of
>>> sizeof/bitsizeof/typeinfo.
>>
>> Well, this is a hack as well, no?
>
> At least it doesn't require a global variable, and it's a hack that already exists (in the sense that it won't introduce a new hack nor the same hack in an additional place, but reuse the same hack for the new functionality). So if the current "allowed"-field hack for the ttypenodes is fixed, this one should be fixable at the same time in the same way.

Implementing the hack wasn't as "straightforward" then the "allowed" 
hack though...

The problem is, that ttypenode.pass_1 is never called in a situation 
like "THelperType.SomeMethod", because the node of "THelperType" is just 
passed to tcallnode as method pointer. Thus I needed to implement the 
check in tcallnode.pass_1 while the flag is defined in ttypenode (the 
check is in place in ttypenode.pass_1 as well though).
As a side effect I also needed to activate the flag 
"helperallowed:=true" for "inherited" as there the situation "tcallnode 
with a ttypenode" (which triggers the check at the end) is encountered 
as well.

The latter change is not yet commited (I will do that tomorrow), but the 
implementation of the flag and the removing of "current_syssym" are 
already commited.

Regards,
Sven



More information about the fpc-devel mailing list