mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 01:06:02 +02:00
* pas2jni: Fixed code generation in case of duplicate method names in a class hierarchy.
git-svn-id: trunk@31463 -
This commit is contained in:
parent
a4502a50d5
commit
130eba51ee
@ -198,6 +198,18 @@ const
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function IsSameType(t1, t2: TDef): boolean;
|
||||||
|
begin
|
||||||
|
Result:=t1 = t2;
|
||||||
|
if Result then
|
||||||
|
exit;
|
||||||
|
if (t1 = nil) or (t2 = nil) or (t1.DefType <> t2.DefType) then
|
||||||
|
exit;
|
||||||
|
if t1.DefType <> dtType then
|
||||||
|
exit;
|
||||||
|
Result:=TTypeDef(t1).BasicType = TTypeDef(t2).BasicType;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TReplDef }
|
{ TReplDef }
|
||||||
|
|
||||||
procedure TReplDef.SetIsUsed(const AValue: boolean);
|
procedure TReplDef.SetIsUsed(const AValue: boolean);
|
||||||
@ -310,10 +322,10 @@ begin
|
|||||||
if d.DefType <> dtProc then
|
if d.DefType <> dtProc then
|
||||||
exit;
|
exit;
|
||||||
p:=TProcDef(d);
|
p:=TProcDef(d);
|
||||||
if (ReturnType <> p.ReturnType) and (Count = p.Count) and inherited IsReplacedBy(p) then begin
|
if (Count = p.Count) and inherited IsReplacedBy(p) then begin
|
||||||
// Check parameter types
|
// Check parameter types
|
||||||
for i:=0 to Count - 1 do
|
for i:=0 to Count - 1 do
|
||||||
if TVarDef(Items[i]).VarType <> TVarDef(p.Items[i]).VarType then
|
if not IsSameType(TVarDef(Items[i]).VarType, TVarDef(p.Items[i]).VarType) then
|
||||||
exit;
|
exit;
|
||||||
Result:=True;
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
@ -356,7 +368,7 @@ end;
|
|||||||
|
|
||||||
function TVarDef.IsReplacedBy(d: TReplDef): boolean;
|
function TVarDef.IsReplacedBy(d: TReplDef): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(d.DefType in [dtProp, dtField]) and (VarType <> TVarDef(d).VarType) and inherited IsReplacedBy(d);
|
Result:=(d.DefType in [dtProp, dtField]) and not IsSameType(VarType, TVarDef(d).VarType) and inherited IsReplacedBy(d);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TVarDef.CanReplaced: boolean;
|
function TVarDef.CanReplaced: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user