mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 03:58:16 +01:00
codetools: FindIdentifierInUsesSection raise error after checking others
git-svn-id: trunk@26342 -
This commit is contained in:
parent
d130d94e34
commit
78b2105e0c
@ -5306,13 +5306,33 @@ var
|
|||||||
OldFlags: TFindDeclarationFlags;
|
OldFlags: TFindDeclarationFlags;
|
||||||
Node: TCodeTreeNode;
|
Node: TCodeTreeNode;
|
||||||
CollectResult: TIdentifierFoundResult;
|
CollectResult: TIdentifierFoundResult;
|
||||||
|
MissingUnitNamePos: Integer;
|
||||||
|
|
||||||
|
procedure RaiseUnitNotFound;
|
||||||
|
var
|
||||||
|
AnUnitName: String;
|
||||||
|
aFilename: String;
|
||||||
|
begin
|
||||||
|
MoveCursorToCleanPos(MissingUnitNamePos);
|
||||||
|
ReadNextAtom;
|
||||||
|
AnUnitName:=GetAtom;
|
||||||
|
ReadNextAtom;
|
||||||
|
if UpAtomIs('IN') then begin
|
||||||
|
ReadNextAtom;
|
||||||
|
aFilename:=GetAtom;
|
||||||
|
end else
|
||||||
|
aFilename:=AnUnitName;
|
||||||
|
RaiseExceptionInstance(
|
||||||
|
ECodeToolUnitNotFound.Create(Self,Format(ctsUnitNotFound,[AnUnitName]),aFilename));
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IFDEF CheckNodeTool}CheckNodeTool(UsesNode);{$ENDIF}
|
{$IFDEF CheckNodeTool}CheckNodeTool(UsesNode);{$ENDIF}
|
||||||
{$IFDEF ShowTriedParentContexts}
|
{$IFDEF ShowTriedParentContexts}
|
||||||
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',MainFilename,' fdfIgnoreUsedUnits=',fdfIgnoreUsedUnits in Params.Flags]);
|
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',MainFilename,' fdfIgnoreUsedUnits=',fdfIgnoreUsedUnits in Params.Flags]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=false;
|
Result:=false;
|
||||||
// first search in used unit names
|
// first search the identifier in the uses section (not in the interfaces of the units)
|
||||||
if (Params.IdentifierTool=Self) then begin
|
if (Params.IdentifierTool=Self) then begin
|
||||||
Node:=UsesNode.LastChild;
|
Node:=UsesNode.LastChild;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
@ -5338,6 +5358,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if not (fdfIgnoreUsedUnits in Params.Flags) then begin
|
if not (fdfIgnoreUsedUnits in Params.Flags) then begin
|
||||||
|
MissingUnitNamePos:=0;
|
||||||
// search in units
|
// search in units
|
||||||
Node:=UsesNode.LastChild;
|
Node:=UsesNode.LastChild;
|
||||||
while Node<>nil do begin
|
while Node<>nil do begin
|
||||||
@ -5350,19 +5371,28 @@ begin
|
|||||||
InAtom:=CurPos;
|
InAtom:=CurPos;
|
||||||
end else
|
end else
|
||||||
InAtom.StartPos:=0;
|
InAtom.StartPos:=0;
|
||||||
NewCodeTool:=OpenCodeToolForUnit(UnitNameAtom,InAtom,true);
|
NewCodeTool:=OpenCodeToolForUnit(UnitNameAtom,InAtom,false);
|
||||||
// search the identifier in the interface of the used unit
|
if NewCodeTool<>nil then begin
|
||||||
OldFlags:=Params.Flags;
|
// search the identifier in the interface of the used unit
|
||||||
Params.Flags:=[fdfIgnoreUsedUnits]+(fdfGlobalsSameIdent*Params.Flags)
|
OldFlags:=Params.Flags;
|
||||||
-[fdfExceptionOnNotFound];
|
Params.Flags:=[fdfIgnoreUsedUnits]+(fdfGlobalsSameIdent*Params.Flags)
|
||||||
Result:=NewCodeTool.FindIdentifierInInterface(Self,Params);
|
-[fdfExceptionOnNotFound];
|
||||||
Params.Flags:=OldFlags;
|
Result:=NewCodeTool.FindIdentifierInInterface(Self,Params);
|
||||||
|
Params.Flags:=OldFlags;
|
||||||
|
if Result and Params.IsFinal then exit;
|
||||||
|
end else if MissingUnitNamePos=0 then begin
|
||||||
|
MissingUnitNamePos:=UnitNameAtom.StartPos;
|
||||||
|
end;
|
||||||
{$IFDEF ShowTriedParentContexts}
|
{$IFDEF ShowTriedParentContexts}
|
||||||
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',GetAtom(UnitNameAtom),' Result=',Result,' IsFinal=',Params.IsFinal]);
|
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',GetAtom(UnitNameAtom),' Result=',Result,' IsFinal=',Params.IsFinal]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if Result and Params.IsFinal then exit;
|
|
||||||
Node:=Node.PriorBrother;
|
Node:=Node.PriorBrother;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (not Result) and (MissingUnitNamePos>0) then begin
|
||||||
|
// identifier not found and there is a missing unit
|
||||||
|
RaiseUnitNotFound;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -201,6 +201,8 @@ end;
|
|||||||
|
|
||||||
constructor TIDEAnchorDockMaster.Create;
|
constructor TIDEAnchorDockMaster.Create;
|
||||||
begin
|
begin
|
||||||
|
inherited Create;
|
||||||
|
fEnabled:=true;
|
||||||
IDEAnchorDockMaster:=Self;
|
IDEAnchorDockMaster:=Self;
|
||||||
DockMaster.OnCreateControl:=@DockMasterCreateControl;
|
DockMaster.OnCreateControl:=@DockMasterCreateControl;
|
||||||
DockMaster.OnShowOptions:=@ShowAnchorDockOptions;
|
DockMaster.OnShowOptions:=@ShowAnchorDockOptions;
|
||||||
@ -533,8 +535,6 @@ begin
|
|||||||
OptionsFrame:=TAnchorDockOptionsFrame.Create(Self);
|
OptionsFrame:=TAnchorDockOptionsFrame.Create(Self);
|
||||||
with OptionsFrame do begin
|
with OptionsFrame do begin
|
||||||
Name:='OptionsFrame';
|
Name:='OptionsFrame';
|
||||||
Align:=alBottom;
|
|
||||||
AnchorToNeighbour(akTop,6,EnableCheckBox);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -553,8 +553,11 @@ begin
|
|||||||
if ADialog=nil then ;
|
if ADialog=nil then ;
|
||||||
if IDEDockMaster=IDEAnchorDockMaster then begin
|
if IDEDockMaster=IDEAnchorDockMaster then begin
|
||||||
NoteLabel.Visible:=false;
|
NoteLabel.Visible:=false;
|
||||||
EnableCheckBox.Enabled:=false;
|
EnableCheckBox.AnchorParallel(akTop,6,Self);
|
||||||
OptionsFrame.Visible:=false;
|
OptionsFrame.Align:=alBottom;
|
||||||
|
OptionsFrame.AnchorToNeighbour(akTop,6,EnableCheckBox);
|
||||||
|
OptionsFrame.Parent:=Self;
|
||||||
|
EnableCheckBox.Caption:=adrsDockingEnabledRequiresARestartOfTheIDE;
|
||||||
end else begin
|
end else begin
|
||||||
NoteLabel.Visible:=true;
|
NoteLabel.Visible:=true;
|
||||||
NoteLabel.Caption:=Format(adrsToUseAnchordockingYouMustFirstUninstall, [
|
NoteLabel.Caption:=Format(adrsToUseAnchordockingYouMustFirstUninstall, [
|
||||||
@ -562,9 +565,9 @@ begin
|
|||||||
NoteLabel.Hint:=Format(
|
NoteLabel.Hint:=Format(
|
||||||
adrsThereIsAnotherDockMasterInstalledOnlyOneDockingPac, [DbgSName(
|
adrsThereIsAnotherDockMasterInstalledOnlyOneDockingPac, [DbgSName(
|
||||||
IDEDockMaster)]);
|
IDEDockMaster)]);
|
||||||
OptionsFrame.Visible:=true;
|
EnableCheckBox.Visible:=false;
|
||||||
|
OptionsFrame.Parent:=nil;
|
||||||
end;
|
end;
|
||||||
EnableCheckBox.Caption:=adrsDockingEnabledRequiresARestartOfTheIDE;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TAnchorDockIDEFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
procedure TAnchorDockIDEFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user