mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 20:39:34 +02:00
* pas2jni: Fixed procedure parameters parsing in some cases.
git-svn-id: trunk@33083 -
This commit is contained in:
parent
e488d7c81c
commit
111595dcd9
@ -361,7 +361,7 @@ begin
|
||||
exit;
|
||||
if AValue and (RefCnt = 0) then begin
|
||||
for i:=0 to Count - 1 do
|
||||
if TVarDef(Items[i]).VarType = nil then
|
||||
if (Items[i].DefType = dtParam) and (TVarDef(Items[i]).VarType = nil) then
|
||||
exit; // If procedure has unsupported parameters, don't use it
|
||||
end;
|
||||
inherited SetIsUsed(AValue);
|
||||
|
@ -427,7 +427,8 @@ var
|
||||
if (j < 0) or (Written.Objects[j] = c) then begin
|
||||
s:=p.Name + ':';
|
||||
for j:=0 to p.Count - 1 do
|
||||
s:=s + DefToJniSig(p[j]);
|
||||
if p[j].DefType = dtParam then
|
||||
s:=s + DefToJniSig(TVarDef(p[j]).VarType);
|
||||
if Written.IndexOf(s) < 0 then begin
|
||||
OldRet:=p.ReturnType;
|
||||
p.ReturnType:=d;
|
||||
@ -674,7 +675,7 @@ end;
|
||||
procedure TWriter.WriteProc(d: TProcDef; Variable: TVarDef; AParent: TDef);
|
||||
var
|
||||
i, j, ClassIdx: integer;
|
||||
s, ss, TempRes, VarFin: string;
|
||||
s, ss, ps, TempRes, VarFin: string;
|
||||
err, tf: boolean;
|
||||
pi: TProcInfo;
|
||||
ci: TClassInfo;
|
||||
@ -851,6 +852,7 @@ begin
|
||||
s:=s + pi.Name;
|
||||
if Count > 0 then begin
|
||||
s:=s + '(';
|
||||
ps:='';
|
||||
for j:=0 to Count - 1 do begin
|
||||
vd:=TVarDef(Items[j]);
|
||||
if vd.DefType <> dtParam then
|
||||
@ -864,11 +866,11 @@ begin
|
||||
ss:=Items[j].Name;
|
||||
ss:=JniToPasType(vd.VarType, ss, False);
|
||||
end;
|
||||
if j <> 0 then
|
||||
s:=s + ', ';
|
||||
s:=s + ss;
|
||||
if ps <> '' then
|
||||
ps:=ps + ', ';
|
||||
ps:=ps + ss;
|
||||
end;
|
||||
s:=s + ')';
|
||||
s:=s + ps + ')';
|
||||
end;
|
||||
end
|
||||
else begin
|
||||
@ -2128,15 +2130,12 @@ var
|
||||
j: integer;
|
||||
begin
|
||||
with d do begin
|
||||
if Count > 0 then
|
||||
s:='('
|
||||
else
|
||||
s:='';
|
||||
s:='';
|
||||
for j:=0 to Count - 1 do
|
||||
with TVarDef(Items[j]) do begin
|
||||
if DefType <> dtParam then
|
||||
continue;
|
||||
if j > 0 then
|
||||
if s <> '' then
|
||||
s:=s + '; ';
|
||||
if voVar in VarOpt then
|
||||
s:=s + 'var '
|
||||
@ -2153,8 +2152,8 @@ begin
|
||||
s:=s + ': ' + GetPasType(VarType, FullTypeNames);
|
||||
end;
|
||||
|
||||
if Count > 0 then
|
||||
s:=s + ')';
|
||||
if s <> '' then
|
||||
s:='(' + s + ')';
|
||||
case ProcType of
|
||||
ptConstructor:
|
||||
ss:='constructor';
|
||||
|
Loading…
Reference in New Issue
Block a user