mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 08:59:26 +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
|
||||
|
||||
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 }
|
||||
|
||||
procedure TReplDef.SetIsUsed(const AValue: boolean);
|
||||
@ -310,10 +322,10 @@ begin
|
||||
if d.DefType <> dtProc then
|
||||
exit;
|
||||
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
|
||||
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;
|
||||
Result:=True;
|
||||
end;
|
||||
@ -356,7 +368,7 @@ end;
|
||||
|
||||
function TVarDef.IsReplacedBy(d: TReplDef): boolean;
|
||||
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;
|
||||
|
||||
function TVarDef.CanReplaced: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user