mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-13 16:49:43 +01:00
codetools: fixed FixForwardDefinitions result when no definitions found
git-svn-id: trunk@14534 -
This commit is contained in:
parent
d8cf78193b
commit
1d92eaff9e
@ -3688,7 +3688,10 @@ var
|
||||
Graph: TCodeGraph;
|
||||
begin
|
||||
Result:=false;
|
||||
if (SourceChangeCache=nil) or (Scanner=nil) then exit;
|
||||
if (SourceChangeCache=nil) or (Scanner=nil) then begin
|
||||
DebugLn(['TCodeCompletionCodeTool.FixForwardDefinitions no scanner']);
|
||||
exit;
|
||||
end;
|
||||
Definitions:=nil;
|
||||
Graph:=nil;
|
||||
try
|
||||
@ -3697,13 +3700,25 @@ begin
|
||||
//if not MovePointerTypesToTargetSections(SourceChangeCache) then exit;
|
||||
//exit(true);
|
||||
|
||||
if not BuildUnitDefinitionGraph(Definitions,Graph,true) or (Graph=nil) then
|
||||
if not BuildUnitDefinitionGraph(Definitions,Graph,true) then begin
|
||||
DebugLn(['TCodeCompletionCodeTool.FixForwardDefinitions BuildUnitDefinitionGraph failed']);
|
||||
exit;
|
||||
end;
|
||||
if Graph=nil then begin
|
||||
// no definitions found
|
||||
exit(true);
|
||||
end;
|
||||
SourceChangeCache.MainScanner:=Scanner;
|
||||
// fix circles
|
||||
if not CheckCircles(Definitions,Graph) then exit;
|
||||
if not CheckCircles(Definitions,Graph) then begin
|
||||
DebugLn(['TCodeCompletionCodeTool.FixForwardDefinitions CheckCircles failed']);
|
||||
exit;
|
||||
end;
|
||||
// now the graph is acyclic and nodes can be moved
|
||||
if not CheckOrder(Definitions,Graph) then exit;
|
||||
if not CheckOrder(Definitions,Graph) then begin
|
||||
DebugLn(['TCodeCompletionCodeTool.FixForwardDefinitions CheckOrder failed']);
|
||||
exit;
|
||||
end;
|
||||
finally
|
||||
UpdateGraph(Definitions,Graph,false);
|
||||
end;
|
||||
@ -3888,7 +3903,10 @@ begin
|
||||
DefinitionsTreeOfCodeTreeNodeExt:=nil;
|
||||
Graph:=nil;
|
||||
if not GatherUnitDefinitions(DefinitionsTreeOfCodeTreeNodeExt,false,true) then
|
||||
begin
|
||||
DebugLn(['TCodeCompletionCodeTool.BuildUnitDefinitionGraph GatherUnitDefinitions failed']);
|
||||
exit;
|
||||
end;
|
||||
if DefinitionsTreeOfCodeTreeNodeExt=nil then exit(true);
|
||||
|
||||
AVLNode:=DefinitionsTreeOfCodeTreeNodeExt.FindLowest;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user