mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:35:57 +02:00
codetools: go to real class declaration for fsfSkipClassForward. Issue #29515
git-svn-id: trunk@51423 -
This commit is contained in:
parent
61dcce50a6
commit
f2bfc63670
@ -1910,16 +1910,25 @@ var
|
|||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
DirectSearch, SkipChecks, SearchForward: boolean;
|
DirectSearch, SkipChecks, SearchForward: boolean;
|
||||||
|
|
||||||
procedure CheckIfCursorOnAForwardDefinedClass;
|
function CheckIfNodeIsForwardDefinedClass(ANode: TCodeTreeNode;
|
||||||
|
ATool: TFindDeclarationTool): Boolean;
|
||||||
var
|
var
|
||||||
TypeNode: TCodeTreeNode;
|
TypeNode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
if SkipChecks then exit;
|
Result := False;
|
||||||
if not (CursorNode.Desc in [ctnTypeDefinition,ctnGenericType]) then exit;
|
if not (ANode.Desc in [ctnTypeDefinition,ctnGenericType]) then exit;
|
||||||
TypeNode:=FindTypeNodeOfDefinition(CursorNode);
|
TypeNode:=ATool.FindTypeNodeOfDefinition(ANode);
|
||||||
if (TypeNode<>nil)
|
if (TypeNode<>nil)
|
||||||
and (TypeNode.Desc in AllClasses)
|
and (TypeNode.Desc in AllClasses)
|
||||||
and ((TypeNode.SubDesc and ctnsForwardDeclaration)>0) then
|
and ((TypeNode.SubDesc and ctnsForwardDeclaration)>0)
|
||||||
|
then
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CheckIfCursorOnAForwardDefinedClass;
|
||||||
|
begin
|
||||||
|
if SkipChecks then exit;
|
||||||
|
if CheckIfNodeIsForwardDefinedClass(CursorNode, Self) then
|
||||||
begin
|
begin
|
||||||
DirectSearch:=true;
|
DirectSearch:=true;
|
||||||
SearchForward:=true;
|
SearchForward:=true;
|
||||||
@ -1927,13 +1936,6 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CheckIfCursorInTypeNode;
|
|
||||||
begin
|
|
||||||
if (CursorNode.Desc in AllIdentifierDefinitions)
|
|
||||||
and (fsfSkipClassForward in SearchSmartFlags) then
|
|
||||||
Exclude(SearchSmartFlags,fsfSkipClassForward);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure CheckIfCursorInClassNode;
|
procedure CheckIfCursorInClassNode;
|
||||||
begin
|
begin
|
||||||
if SkipChecks then exit;
|
if SkipChecks then exit;
|
||||||
@ -2083,6 +2085,7 @@ var
|
|||||||
CursorAtIdentifier: boolean;
|
CursorAtIdentifier: boolean;
|
||||||
IdentifierStart: PChar;
|
IdentifierStart: PChar;
|
||||||
LineRange: TLineRange;
|
LineRange: TLineRange;
|
||||||
|
ForwardXY: TCodeXYPosition;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
NewExprType:=CleanExpressionType;
|
NewExprType:=CleanExpressionType;
|
||||||
@ -2226,7 +2229,6 @@ begin
|
|||||||
SearchForward:=false;
|
SearchForward:=false;
|
||||||
CheckIfCursorOnAForwardDefinedClass;
|
CheckIfCursorOnAForwardDefinedClass;
|
||||||
CheckIfCursorInClassNode;
|
CheckIfCursorInClassNode;
|
||||||
CheckIfCursorInTypeNode;
|
|
||||||
CheckIfCursorInProcNode;
|
CheckIfCursorInProcNode;
|
||||||
CheckIfCursorInPropertyNode;
|
CheckIfCursorInPropertyNode;
|
||||||
// set cursor on identifier
|
// set cursor on identifier
|
||||||
@ -2263,6 +2265,15 @@ begin
|
|||||||
Result:=FindIdentifierInContext(Params);
|
Result:=FindIdentifierInContext(Params);
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
begin
|
||||||
|
// if we skip forward class definitions and we found one -> proceed search!
|
||||||
|
if (fsfSkipClassForward in SearchSmartFlags)
|
||||||
|
and CheckIfNodeIsForwardDefinedClass(Params.NewNode, Params.NewCodeTool)
|
||||||
|
and Params.NewCodeTool.CleanPosToCaret(Params.NewNode.StartPos, ForwardXY)
|
||||||
|
and Params.NewCodeTool.FindDeclaration(ForwardXY, SearchSmartFlags-[fsfSkipClassForward],
|
||||||
|
NewExprType, NewPos, NewTopLine)
|
||||||
|
then
|
||||||
|
Exit(True);
|
||||||
|
|
||||||
NewExprType.Desc:=xtContext;
|
NewExprType.Desc:=xtContext;
|
||||||
NewExprType.Context.Node:=Params.NewNode;
|
NewExprType.Context.Node:=Params.NewNode;
|
||||||
NewExprType.Context.Tool:=Params.NewCodeTool;
|
NewExprType.Context.Tool:=Params.NewCodeTool;
|
||||||
|
Loading…
Reference in New Issue
Block a user