mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 19:43:48 +02:00
codetools: find references: fixed error handling
git-svn-id: trunk@26434 -
This commit is contained in:
parent
769c96eb77
commit
946f34ba8f
@ -2210,10 +2210,11 @@ begin
|
||||
except
|
||||
on e: Exception do HandleException(e);
|
||||
end;
|
||||
if not Result then begin
|
||||
if (not Result) or (NewNode=nil) then begin
|
||||
DebugLn('TCodeToolManager.FindReferences unable to FindDeclaration ',IdentifierCode.Filename,' x=',dbgs(x),' y=',dbgs(y));
|
||||
exit;
|
||||
end;
|
||||
Result:=true;
|
||||
// check if scope can be limited
|
||||
PrivateDeclaration:=(NewTool.GetSourceType in [ctnLibrary,ctnProgram]);
|
||||
if not PrivateDeclaration then begin
|
||||
@ -2222,6 +2223,10 @@ begin
|
||||
then
|
||||
PrivateDeclaration:=true;
|
||||
end;
|
||||
if not PrivateDeclaration then begin
|
||||
if (NewNode.Parent<>nil) and (NewNode.Parent.Desc=ctnParameterList) then
|
||||
PrivateDeclaration:=true;
|
||||
end;
|
||||
if NewTopLine=0 then ;
|
||||
if not InitCurCodeTool(TargetCode) then exit;
|
||||
if PrivateDeclaration and (FCurCodeTool<>NewTool) then exit(true);
|
||||
|
@ -3974,7 +3974,7 @@ var
|
||||
else
|
||||
Params.Clear;
|
||||
Params.Flags:=[fdfSearchInParentNodes,fdfSearchInAncestors,
|
||||
fdfExceptionOnNotFound,fdfIgnoreCurContextNode];
|
||||
fdfIgnoreCurContextNode];
|
||||
if NodeIsForwardDeclaration(CursorNode) then begin
|
||||
//debugln('Node is forward declaration');
|
||||
Params.Flags:=Params.Flags+[fdfSearchForward];
|
||||
@ -3991,8 +3991,14 @@ var
|
||||
else
|
||||
Found:=FindDeclarationOfIdentAtParam(Params);
|
||||
except
|
||||
on E: ECodeToolError do
|
||||
if not IsComment then raise;
|
||||
on E: ECodeToolError do begin
|
||||
if E.Sender<>Self then begin
|
||||
// there is an error in another unit, which prevetns searching
|
||||
// stop further searching in this unit
|
||||
raise;
|
||||
end;
|
||||
// continue
|
||||
end;
|
||||
on E: Exception do
|
||||
raise;
|
||||
end;
|
||||
|
@ -41,7 +41,7 @@ uses
|
||||
AVL_Tree, CodeTree, CodeAtom, CodeCache, CodeToolManager,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, IDEProcs, IDEWindowIntf, MiscOptions, DialogProcs,
|
||||
InputHistory, SearchResultView, CodeHelp, ButtonPanel;
|
||||
LazIDEIntf, InputHistory, SearchResultView, CodeHelp, ButtonPanel;
|
||||
|
||||
type
|
||||
|
||||
@ -176,6 +176,7 @@ begin
|
||||
|
||||
// search in every file
|
||||
for i:=0 to Files.Count-1 do begin
|
||||
//debugln(['GatherIdentifierReferences ',Files[i]]);
|
||||
LoadResult:=
|
||||
LoadCodeBuffer(Code,Files[i],[lbfCheckIfText,lbfUpdateFromDisk],true);
|
||||
if LoadResult=mrAbort then begin
|
||||
|
Loading…
Reference in New Issue
Block a user