[fpc-pascal] TParamFlags and fpc 3.2.0.
fredvs
fiens at hotmail.com
Sat Jul 27 17:54:22 CEST 2019
Hello Sven.
> That said the code I showed you had an issue which might explain the
> behaviour you got:
I did try your new code but get that error message at compilation:
msedesignparser.pas(722,11) Error: Incompatible types: got "TParamFlag"
expected "methodflagty"
msedesignparser.pas(2238) Fatal: There were 1 errors compiling module,
stopping
Fatal: Compilation aborted
-------> Line 722,11 = "if not (pfHidden in flags) then"
The complete code used, following your advice, is this:
.......................
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;
count: Integer= 0;
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;
for int1:= 0 to paramcount - 1 do begin
//with params[int1] do begin
with params[count] do begin
flags:= tparamflags(
{$if FPC_FULLVERSION >= 030100}
wordset{$else}byteset{$endif}(pbyte(po1)^));
inc(po1,{$ifdef mse_fpc_3_2}2{$else}1{$endif});
{$if FPC_FULLVERSION > 030200}
// skip hidden parameters ($self, $high, etc.)
if pfHidden in flags then Continue;
{$endif}
Inc(count);
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;
{$if FPC_FULLVERSION > 030200}
// skip hidden parameters ($self, $high, etc.)
if not (pfHidden in flags) then // line 722 ------------> complier error
message.
{$endif}
Inc(count);
end;
if isfunction then begin
params[high(params)].typename:= getshortstring(po1);
end;
end;
end;
end;
end;
end;
------------------------------------
> You should fix the cause (ignoring hidden parameters) and not the symptoms
> (hidding "$self")
I totally agree with you (if it is possible to do).
Thanks.
Fre;D
-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
More information about the fpc-pascal
mailing list