mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 06:38:24 +02:00
MG: fixed find declaration of forward def class
git-svn-id: trunk@1617 -
This commit is contained in:
parent
4409ebfe2d
commit
d02846cc88
@ -570,10 +570,25 @@ function TFindDeclarationTool.FindDeclaration(CursorPos: TCodeXYPosition;
|
|||||||
var CleanCursorPos: integer;
|
var CleanCursorPos: integer;
|
||||||
CursorNode, ClassNode: TCodeTreeNode;
|
CursorNode, ClassNode: TCodeTreeNode;
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
DirectSearch: boolean;
|
DirectSearch, SkipChecks, SearchForward: boolean;
|
||||||
|
|
||||||
|
procedure CheckIfCursorOnAForwardDefinedClass;
|
||||||
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
|
if CursorNode.Desc=ctnTypeDefinition then begin
|
||||||
|
if (CursorNode.FirstChild<>nil) and (CursorNode.FirstChild.Desc=ctnClass)
|
||||||
|
and ((CursorNode.FirstChild.SubDesc and ctnsForwardDeclaration)>0) then
|
||||||
|
begin
|
||||||
|
DirectSearch:=true;
|
||||||
|
SearchForward:=true;
|
||||||
|
SkipChecks:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure CheckIfCursorInClassNode;
|
procedure CheckIfCursorInClassNode;
|
||||||
begin
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
ClassNode:=CursorNode.GetNodeOfType(ctnClass);
|
ClassNode:=CursorNode.GetNodeOfType(ctnClass);
|
||||||
if ClassNode<>nil then begin
|
if ClassNode<>nil then begin
|
||||||
// cursor is in class/object definition
|
// cursor is in class/object definition
|
||||||
@ -585,6 +600,7 @@ var CleanCursorPos: integer;
|
|||||||
and (CleanCursorPos<ClassNode.FirstChild.StartPos) then begin
|
and (CleanCursorPos<ClassNode.FirstChild.StartPos) then begin
|
||||||
// identifier is an ancestor/interface identifier
|
// identifier is an ancestor/interface identifier
|
||||||
DirectSearch:=true;
|
DirectSearch:=true;
|
||||||
|
SkipChecks:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -592,6 +608,7 @@ var CleanCursorPos: integer;
|
|||||||
|
|
||||||
procedure CheckIfCursorInBeginNode;
|
procedure CheckIfCursorInBeginNode;
|
||||||
begin
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
if CursorNode.Desc=ctnBeginBlock then begin
|
if CursorNode.Desc=ctnBeginBlock then begin
|
||||||
BuildSubTreeForBeginBlock(CursorNode);
|
BuildSubTreeForBeginBlock(CursorNode);
|
||||||
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||||
@ -601,6 +618,7 @@ var CleanCursorPos: integer;
|
|||||||
procedure CheckIfCursorInProcNode;
|
procedure CheckIfCursorInProcNode;
|
||||||
var IsMethod: boolean;
|
var IsMethod: boolean;
|
||||||
begin
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
if CursorNode.Desc=ctnProcedureHead then
|
if CursorNode.Desc=ctnProcedureHead then
|
||||||
CursorNode:=CursorNode.Parent;
|
CursorNode:=CursorNode.Parent;
|
||||||
if CursorNode.Desc=ctnProcedure then begin
|
if CursorNode.Desc=ctnProcedure then begin
|
||||||
@ -624,6 +642,7 @@ var CleanCursorPos: integer;
|
|||||||
// cursor on proc name
|
// cursor on proc name
|
||||||
// -> ignore proc name and search overloaded identifier
|
// -> ignore proc name and search overloaded identifier
|
||||||
DirectSearch:=true;
|
DirectSearch:=true;
|
||||||
|
SkipChecks:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if CursorNode.Desc=ctnProcedureHead then
|
if CursorNode.Desc=ctnProcedureHead then
|
||||||
@ -633,17 +652,21 @@ var CleanCursorPos: integer;
|
|||||||
|
|
||||||
procedure CheckIfCursorInPropertyNode;
|
procedure CheckIfCursorInPropertyNode;
|
||||||
begin
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
if CursorNode.Desc=ctnProperty then begin
|
if CursorNode.Desc=ctnProperty then begin
|
||||||
MoveCursorToNodeStart(CursorNode);
|
MoveCursorToNodeStart(CursorNode);
|
||||||
ReadNextAtom; // read 'property'
|
ReadNextAtom; // read 'property'
|
||||||
ReadNextAtom; // read property name
|
ReadNextAtom; // read property name
|
||||||
if CleanCursorPos<CurPos.EndPos then
|
if CleanCursorPos<CurPos.EndPos then begin
|
||||||
DirectSearch:=true;
|
DirectSearch:=true;
|
||||||
|
SkipChecks:=true;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
SkipChecks:=false;
|
||||||
ActivateGlobalWriteLock;
|
ActivateGlobalWriteLock;
|
||||||
try
|
try
|
||||||
// build code tree
|
// build code tree
|
||||||
@ -673,6 +696,8 @@ begin
|
|||||||
NewPos,NewTopLine);
|
NewPos,NewTopLine);
|
||||||
end else begin
|
end else begin
|
||||||
DirectSearch:=false;
|
DirectSearch:=false;
|
||||||
|
SearchForward:=false;
|
||||||
|
CheckIfCursorOnAForwardDefinedClass;
|
||||||
CheckIfCursorInClassNode;
|
CheckIfCursorInClassNode;
|
||||||
CheckIfCursorInBeginNode;
|
CheckIfCursorInBeginNode;
|
||||||
CheckIfCursorInProcNode;
|
CheckIfCursorInProcNode;
|
||||||
@ -693,13 +718,14 @@ begin
|
|||||||
Params.ContextNode:=CursorNode;
|
Params.ContextNode:=CursorNode;
|
||||||
Params.SetIdentifier(Self,@Src[CurPos.StartPos],@CheckSrcIdentifier);
|
Params.SetIdentifier(Self,@Src[CurPos.StartPos],@CheckSrcIdentifier);
|
||||||
Params.Flags:=[fdfSearchInParentNodes,fdfExceptionOnNotFound,
|
Params.Flags:=[fdfSearchInParentNodes,fdfExceptionOnNotFound,
|
||||||
fdfTopLvlResolving];
|
fdfTopLvlResolving,fdfSearchInAncestors]
|
||||||
Params.Flags:=Params.Flags
|
+fdfAllClassVisibilities;
|
||||||
+[fdfSearchInAncestors]+fdfAllClassVisibilities;
|
|
||||||
if not DirectSearch then begin
|
if not DirectSearch then begin
|
||||||
Result:=FindDeclarationOfIdentAtCursor(Params);
|
Result:=FindDeclarationOfIdentAtCursor(Params);
|
||||||
end else begin
|
end else begin
|
||||||
Include(Params.Flags,fdfIgnoreCurContextNode);
|
Include(Params.Flags,fdfIgnoreCurContextNode);
|
||||||
|
if SearchForward then
|
||||||
|
Include(Params.Flags,fdfSearchForward);
|
||||||
Result:=FindIdentifierInContext(Params);
|
Result:=FindIdentifierInContext(Params);
|
||||||
end;
|
end;
|
||||||
if Result then begin
|
if Result then begin
|
||||||
|
@ -606,12 +606,10 @@ begin
|
|||||||
Add('ARRAY',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('ARRAY',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('ASM',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('ASM',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('BEGIN',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('BEGIN',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('BREAK',{$ifdef FPC}@{$endif}AllwaysTrue);
|
|
||||||
Add('CASE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('CASE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('CLASS',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('CLASS',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('CONST',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('CONST',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('CONSTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('CONSTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('CONTINUE',{$ifdef FPC}@{$endif}AllwaysTrue);
|
|
||||||
Add('DESTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('DESTRUCTOR',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('DIV',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('DIV',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
Add('DO',{$ifdef FPC}@{$endif}AllwaysTrue);
|
Add('DO',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||||
|
@ -124,7 +124,9 @@ type
|
|||||||
property Visible;
|
property Visible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable);
|
TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed,
|
||||||
|
csOwnerDrawVariable);
|
||||||
|
|
||||||
|
|
||||||
TCustomComboBox = class(TWinControl)
|
TCustomComboBox = class(TWinControl)
|
||||||
private
|
private
|
||||||
@ -579,6 +581,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.23 2002/04/18 07:53:08 lazarus
|
||||||
|
MG: fixed find declaration of forward def class
|
||||||
|
|
||||||
Revision 1.22 2002/03/25 17:59:19 lazarus
|
Revision 1.22 2002/03/25 17:59:19 lazarus
|
||||||
GTK Cleanup
|
GTK Cleanup
|
||||||
Shane
|
Shane
|
||||||
|
Loading…
Reference in New Issue
Block a user