[fpc-pascal] TParamFlags and fpc 3.2.0.

Sven Barth pascaldragon at googlemail.com
Fri Jul 26 23:53:23 CEST 2019


Am 26.07.2019 um 14:50 schrieb fredvs:
> But, imho, there is problem with the behavior of fpc-ptypeinfo and filter in
> TParamFlags.
> Dont worry, I will not annoy you with this.
There is no problem with PTypeInfo or TParamFlags. The tests for these 
functionalities pass without any issues on multiple platforms.

You should fix the cause (ignoring hidden parameters) and not the 
symptoms (hidding "$self"), because the latter will cause you a headache 
further down (e.g. if you have a function with an open array parameter 
which will have a "$highArgN" parameter for each open array).

That said the code I showed you had an issue which might explain the 
behaviour you got:

=== code begin ===

  for int1:= 0 to paramcount - 1 do begin
       with params[int1] do begin
// replace previous line with:
   with params[count] do begin

            flags:= tparamflags(
              {$ifdef
    mse_fpc_3_2}wordset{$else}byteset{$endif}(pbyte(po1)^));
            inc(po1,{$ifdef mse_fpc_3_2}2{$else}1{$endif});


// the following code block of mine
{$ifdef mse_fpc_3_2}
   // skip hidden parameters ($self, $high, etc.)
   if pfHidden in flags then
     Continue;
   {$endif}
   Inc(count);
// up until here, needs to be further down (see below)
// so remove this block again

        name:= getshortstring(po1);
        typename:= getshortstring(po1);
        if (typename = 'WideString') or (typename = 'UnicodeString') then
begin
         typename:= 'msestring';
        end
        else begin
         if typename = 'LongInt' then begin
          typename:= 'Integer';
         end
         else begin
          if typename = 'Double' then begin
           typename:= 'Real';
          end;
         end;
        end;
       end; // I think this is the end of the with-clause
// we adjust the code a little bit as the continue is not needed at this 
location
// this way we always increase the count on < 3.2 and only if it's not 
hidden
// on >= 3.2; we need to put this at the end so that po1 is advanced 
correctly
{$ifdef mse_fpc_3_2}
   // skip hidden parameters ($self, $high, etc.)
   if not (pfHidden in flags) then
   {$endif}
   Inc(count);
      end;

=== code end ===

This should hopefully solve the issue.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190726/aa07eacf/attachment.html>


More information about the fpc-pascal mailing list