mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 06:00:43 +02:00
codetools: fixed checking protected properties in ancestors, bug #14027
git-svn-id: trunk@20988 -
This commit is contained in:
parent
8370c4d387
commit
9b6129ffaa
@ -926,6 +926,7 @@ var
|
|||||||
var
|
var
|
||||||
NewItem: TIdentifierListItem;
|
NewItem: TIdentifierListItem;
|
||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
|
ProtectedForeignClass: Boolean;
|
||||||
begin
|
begin
|
||||||
// proceed searching ...
|
// proceed searching ...
|
||||||
Result:=ifrProceedSearch;
|
Result:=ifrProceedSearch;
|
||||||
@ -944,6 +945,7 @@ begin
|
|||||||
inc(LastGatheredIdentLevel);
|
inc(LastGatheredIdentLevel);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ProtectedForeignClass:=false;
|
||||||
if FoundContext.Tool=Self then begin
|
if FoundContext.Tool=Self then begin
|
||||||
// identifier is in the same unit
|
// identifier is in the same unit
|
||||||
//DebugLn('::: COLLECT IDENT in SELF ',FoundContext.Node.DescAsString,
|
//DebugLn('::: COLLECT IDENT in SELF ',FoundContext.Node.DescAsString,
|
||||||
@ -971,6 +973,7 @@ begin
|
|||||||
//debugln('TIdentCompletionTool.CollectAllIdentifiers ALLOWED Protected in ANCESTOR '+StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)));
|
//debugln('TIdentCompletionTool.CollectAllIdentifiers ALLOWED Protected in ANCESTOR '+StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)));
|
||||||
end else if (FoundContext.Node.Desc=ctnProperty) then begin
|
end else if (FoundContext.Node.Desc=ctnProperty) then begin
|
||||||
// protected property: maybe the visibility was raised => continue
|
// protected property: maybe the visibility was raised => continue
|
||||||
|
ProtectedForeignClass:=true;
|
||||||
//debugln('TIdentCompletionTool.CollectAllIdentifiers MAYBE Protected made Public '+StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)));
|
//debugln('TIdentCompletionTool.CollectAllIdentifiers MAYBE Protected made Public '+StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)));
|
||||||
end else begin
|
end else begin
|
||||||
// otherwise: treat as private
|
// otherwise: treat as private
|
||||||
@ -1024,10 +1027,18 @@ begin
|
|||||||
// only show the real definition, which will follow in the ancestor
|
// only show the real definition, which will follow in the ancestor
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if (FoundContext.Node.Parent.Desc in [ctnClassPrivate,ctnClassProtected])
|
if (FoundContext.Node.Parent.Desc=ctnClassPrivate)
|
||||||
and (FoundContext.Tool<>Self)
|
and (FoundContext.Tool<>Self)
|
||||||
and (not PropertyIsOverridenPublicPublish) then begin
|
and (not PropertyIsOverridenPublicPublish) then begin
|
||||||
// a private/protected property in another unit, that was not
|
// a private property in another unit, that was not
|
||||||
|
// made public/publish later
|
||||||
|
// => skip
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if (FoundContext.Node.Parent.Desc=ctnClassProtected)
|
||||||
|
and ProtectedForeignClass
|
||||||
|
and (not PropertyIsOverridenPublicPublish) then begin
|
||||||
|
// a protected property in another unit, that was not
|
||||||
// made public/publish later
|
// made public/publish later
|
||||||
// => skip
|
// => skip
|
||||||
exit;
|
exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user