mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 14:49:48 +02:00
codetools: findunusedunits: check generic types, bug #26085
git-svn-id: trunk@44832 -
This commit is contained in:
parent
2b826c43d9
commit
16ee2ad735
@ -44,6 +44,7 @@ interface
|
|||||||
{ $DEFINE VerboseGetStringConstBounds}
|
{ $DEFINE VerboseGetStringConstBounds}
|
||||||
{ $DEFINE VerboseCompleteBlock}
|
{ $DEFINE VerboseCompleteBlock}
|
||||||
{ $DEFINE VerboseCheckLFM}
|
{ $DEFINE VerboseCheckLFM}
|
||||||
|
{ $DEFINE VerboseFindUnusedUnits}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF MEM_CHECK}
|
{$IFDEF MEM_CHECK}
|
||||||
@ -1660,7 +1661,6 @@ function TStandardCodeTool.FindUnusedUnits(Units: TStrings): boolean;
|
|||||||
// 'implementation': unit is in implementation uses section
|
// 'implementation': unit is in implementation uses section
|
||||||
// 'used': an identifier of the interface is used
|
// 'used': an identifier of the interface is used
|
||||||
// 'code': unit has non empty initialization/finalization section
|
// 'code': unit has non empty initialization/finalization section
|
||||||
{ $DEFINE VerboseFindUnusedUnits}
|
|
||||||
var
|
var
|
||||||
Identifiers: TAVLTree;// all identifiers used in this unit
|
Identifiers: TAVLTree;// all identifiers used in this unit
|
||||||
|
|
||||||
@ -1756,13 +1756,13 @@ var
|
|||||||
|
|
||||||
function IsNodeVisible(Node: TCodeTreeNode): boolean;
|
function IsNodeVisible(Node: TCodeTreeNode): boolean;
|
||||||
begin
|
begin
|
||||||
if (Node.Parent=nil)
|
Result:=false;
|
||||||
or (Node.Parent.Desc=ctnInterface)
|
Node:=Node.Parent;
|
||||||
or (Node.Parent.Parent=nil)
|
while Node<>nil do begin
|
||||||
or (Node.Parent.Parent.Desc=ctnInterface) then
|
if Node.Desc=ctnInterface then exit(true);
|
||||||
Result:=true
|
if Node.Desc in AllClasses then exit;
|
||||||
else
|
Node:=Node.Parent;
|
||||||
Result:=false;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -1774,7 +1774,7 @@ var
|
|||||||
case Node.Desc of
|
case Node.Desc of
|
||||||
ctnEnumIdentifier:
|
ctnEnumIdentifier:
|
||||||
if IsIdentifierUsed(Node.StartPos) then exit;
|
if IsIdentifierUsed(Node.StartPos) then exit;
|
||||||
ctnVarDefinition,ctnConstDefinition,ctnTypeDefinition:
|
ctnVarDefinition,ctnConstDefinition,ctnTypeDefinition,ctnGenericName:
|
||||||
if IsNodeVisible(Node) and IsIdentifierUsed(Node.StartPos) then exit;
|
if IsNodeVisible(Node) and IsIdentifierUsed(Node.StartPos) then exit;
|
||||||
ctnProcedure:
|
ctnProcedure:
|
||||||
if (Node.Parent.Desc=ctnInterface)
|
if (Node.Parent.Desc=ctnInterface)
|
||||||
|
Loading…
Reference in New Issue
Block a user