mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-02 23:12:05 +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;
|
||||
Node: TCodeTreeNode;
|
||||
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
|
||||
{$IFDEF CheckNodeTool}CheckNodeTool(UsesNode);{$ENDIF}
|
||||
{$IFDEF ShowTriedParentContexts}
|
||||
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',MainFilename,' fdfIgnoreUsedUnits=',fdfIgnoreUsedUnits in Params.Flags]);
|
||||
{$ENDIF}
|
||||
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
|
||||
Node:=UsesNode.LastChild;
|
||||
while Node<>nil do begin
|
||||
@ -5338,6 +5358,7 @@ begin
|
||||
end;
|
||||
|
||||
if not (fdfIgnoreUsedUnits in Params.Flags) then begin
|
||||
MissingUnitNamePos:=0;
|
||||
// search in units
|
||||
Node:=UsesNode.LastChild;
|
||||
while Node<>nil do begin
|
||||
@ -5350,19 +5371,28 @@ begin
|
||||
InAtom:=CurPos;
|
||||
end else
|
||||
InAtom.StartPos:=0;
|
||||
NewCodeTool:=OpenCodeToolForUnit(UnitNameAtom,InAtom,true);
|
||||
// search the identifier in the interface of the used unit
|
||||
OldFlags:=Params.Flags;
|
||||
Params.Flags:=[fdfIgnoreUsedUnits]+(fdfGlobalsSameIdent*Params.Flags)
|
||||
-[fdfExceptionOnNotFound];
|
||||
Result:=NewCodeTool.FindIdentifierInInterface(Self,Params);
|
||||
Params.Flags:=OldFlags;
|
||||
NewCodeTool:=OpenCodeToolForUnit(UnitNameAtom,InAtom,false);
|
||||
if NewCodeTool<>nil then begin
|
||||
// search the identifier in the interface of the used unit
|
||||
OldFlags:=Params.Flags;
|
||||
Params.Flags:=[fdfIgnoreUsedUnits]+(fdfGlobalsSameIdent*Params.Flags)
|
||||
-[fdfExceptionOnNotFound];
|
||||
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}
|
||||
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',GetAtom(UnitNameAtom),' Result=',Result,' IsFinal=',Params.IsFinal]);
|
||||
{$ENDIF}
|
||||
if Result and Params.IsFinal then exit;
|
||||
Node:=Node.PriorBrother;
|
||||
end;
|
||||
|
||||
if (not Result) and (MissingUnitNamePos>0) then begin
|
||||
// identifier not found and there is a missing unit
|
||||
RaiseUnitNotFound;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -201,6 +201,8 @@ end;
|
||||
|
||||
constructor TIDEAnchorDockMaster.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
fEnabled:=true;
|
||||
IDEAnchorDockMaster:=Self;
|
||||
DockMaster.OnCreateControl:=@DockMasterCreateControl;
|
||||
DockMaster.OnShowOptions:=@ShowAnchorDockOptions;
|
||||
@ -533,8 +535,6 @@ begin
|
||||
OptionsFrame:=TAnchorDockOptionsFrame.Create(Self);
|
||||
with OptionsFrame do begin
|
||||
Name:='OptionsFrame';
|
||||
Align:=alBottom;
|
||||
AnchorToNeighbour(akTop,6,EnableCheckBox);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -553,8 +553,11 @@ begin
|
||||
if ADialog=nil then ;
|
||||
if IDEDockMaster=IDEAnchorDockMaster then begin
|
||||
NoteLabel.Visible:=false;
|
||||
EnableCheckBox.Enabled:=false;
|
||||
OptionsFrame.Visible:=false;
|
||||
EnableCheckBox.AnchorParallel(akTop,6,Self);
|
||||
OptionsFrame.Align:=alBottom;
|
||||
OptionsFrame.AnchorToNeighbour(akTop,6,EnableCheckBox);
|
||||
OptionsFrame.Parent:=Self;
|
||||
EnableCheckBox.Caption:=adrsDockingEnabledRequiresARestartOfTheIDE;
|
||||
end else begin
|
||||
NoteLabel.Visible:=true;
|
||||
NoteLabel.Caption:=Format(adrsToUseAnchordockingYouMustFirstUninstall, [
|
||||
@ -562,9 +565,9 @@ begin
|
||||
NoteLabel.Hint:=Format(
|
||||
adrsThereIsAnotherDockMasterInstalledOnlyOneDockingPac, [DbgSName(
|
||||
IDEDockMaster)]);
|
||||
OptionsFrame.Visible:=true;
|
||||
EnableCheckBox.Visible:=false;
|
||||
OptionsFrame.Parent:=nil;
|
||||
end;
|
||||
EnableCheckBox.Caption:=adrsDockingEnabledRequiresARestartOfTheIDE;
|
||||
end;
|
||||
|
||||
procedure TAnchorDockIDEFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user