[fpc-pascal] TParamFlags and fpc 3.2.0.

fredvs fiens at hotmail.com
Thu Jul 25 21:19:06 CEST 2019


> It would help more if you'd point me exactly at the code in question.

OK, now that you see the problem, here the code in mse-ide project:

In msedesignparser.pas, procedure getmethodparaminfo: (Please take a look at
the // in code that follow --> paramlist has one more entry in fpc 320)

--------------------------------------------------------
procedure getmethodparaminfo(const atype: ptypeinfo; 
                                         var info: methodparaminfoty);

  function getshortstring(var po: pchar): string;
  begin
   setlength(result,byte(po^));
   inc(po);
   move(po^,pointer(result)^,length(result));
   inc(po,length(result));
  end;

type
 pparamflags = ^tparamflags;
 paramrecty = record
               Flags : TParamFlags;
              end;
var
 isfunction: boolean;
 int1: integer;
 po1: pchar;
begin
 with info do begin
  kind:= methodkindty(-1);
  params:= nil;
  if (atype^.Kind = tkmethod) then begin
   with gettypedata(atype)^ do begin
    kind:= tmethodkindtomethodkind[methodkind];
    int1:= paramcount;
    isfunction:= methodkind = mkfunction;
    if isfunction then begin
     inc(int1);
    end;
    if isfunction or (methodkind = mkprocedure) then begin
     setlength(params,int1);
    
 po1:= @paramlist; 

// there is now one more first parameter that must be ommited
  
   for int1:= 0 to paramcount - 1 do begin
      with params[int1] 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});
       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;
     end;
     if isfunction then begin
      params[high(params)].typename:= getshortstring(po1);
     end;
    end;
   end;
  end;
 end;
end;
------------------------------------------------------------------------

I did not find how to do for paramlist does not add that first parameter
(maybe it is not possible).

So, as work-around, now in function that parse the code into the
source-editor: tsourceupdater.composeproceduretext().
there is a filter: ----> if name = '$self' then result := '',

With this the problem is fixed.

I have to fix too function parametersmatch() because for matching, first
parameter must be omitted.

To resume: if somebody knows how to not add by default the first $self
parameter in paramlist, I vote for that solution.

Otherwise maybe I will propose the work-around (that works perfectly)  ---->
if name = '$self' then result := '';

Many thanks Sven.

Fre;D






-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/


More information about the fpc-pascal mailing list