diff --git a/.gitattributes b/.gitattributes
index 4d6d8b6657..56f55b8fa5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -992,6 +992,7 @@ components/codetools/tests/fdt_nestedclasses.pas svneol=native#text/plain
components/codetools/tests/fdt_objccategory.pas svneol=native#text/plain
components/codetools/tests/fdt_objcclass.pas svneol=native#text/plain
components/codetools/tests/fdt_typehelper.pas svneol=native#text/plain
+components/codetools/tests/fdt_with.pas svneol=native#text/plain
components/codetools/tests/fdtbase.pas svneol=native#text/plain
components/codetools/tests/finddeclarationtest.lpi svneol=native#text/plain
components/codetools/tests/finddeclarationtest.lpr svneol=native#text/plain
diff --git a/components/codetools/tests/fdt_with.pas b/components/codetools/tests/fdt_with.pas
new file mode 100644
index 0000000000..ebb0582b0b
--- /dev/null
+++ b/components/codetools/tests/fdt_with.pas
@@ -0,0 +1,49 @@
+unit fdt_with;
+
+{$mode objfpc}{$H+}
+
+interface
+
+type
+ TTest = class
+ public
+ I: string;
+ end;
+
+ TContainer = class
+ public
+ Sub: TTest;
+ I: string;
+ end;
+
+implementation
+
+procedure Test;
+var
+ Test: TTest{declaration:fdt_with.TTest};
+ A: array[0..9] of string;
+ X: string;
+ aContainer: TContainer{declaration:fdt_with.TContainer};
+ I: integer;
+begin
+ with Test{declaration:Test.Test} do
+ begin
+ I{declaration:fdt_with.TTest.I} := 'hello';
+ A{declaration:Test.A}[0] := 'abc';
+ end;
+
+ aContainer:=TContainer.Create;
+ with aContainer{declaration:Test.aContainer}, Sub{declaration:fdt_with.TContainer.Sub} do begin
+ I{declaration:fdt_with.TTest.I} := 'tool';
+ end;
+
+ for I{guesstype:Integer} := Low(A{declaration:Test.A}) to High(A) do
+ begin
+ Test.I{declaration:fdt_with.TTest.I} := 'bye';
+ X{declaration:Test.X} := A[I];
+ end;
+ if X='' then ;
+end;
+
+end.
+
diff --git a/components/codetools/tests/fdtbase.pas b/components/codetools/tests/fdtbase.pas
index 768795793f..a1c5d4b196 100644
--- a/components/codetools/tests/fdtbase.pas
+++ b/components/codetools/tests/fdtbase.pas
@@ -2,6 +2,7 @@
Test with:
./finddeclarationtest --format=plain --suite=TTestFindDeclaration
./finddeclarationtest --format=plain --suite=TestFindDeclaration_Basic
+ ./finddeclarationtest --format=plain --suite=TestFindDeclaration_With
./finddeclarationtest --format=plain --suite=TestFindDeclaration_NestedClasses
./finddeclarationtest --format=plain --suite=TestFindDeclaration_ClassHelper
./finddeclarationtest --format=plain --suite=TestFindDeclaration_TypeHelper
@@ -36,6 +37,7 @@ type
procedure FindDeclarations(Filename: string);
published
procedure TestFindDeclaration_Basic;
+ procedure TestFindDeclaration_With;
procedure TestFindDeclaration_NestedClasses;
procedure TestFindDeclaration_ClassHelper;
procedure TestFindDeclaration_TypeHelper;
@@ -84,7 +86,7 @@ procedure TTestFindDeclaration.FindDeclarations(Filename: string);
PrependPath(GetIdentifier(@Tool.Src[Node.StartPos]),Result);
ctnInterface,ctnUnit:
PrependPath(Tool.GetSourceName(false),Result);
- ctnProcedureHead:
+ ctnProcedure:
PrependPath(Tool.ExtractProcName(Node,[]),Result);
end;
Node:=Node.Parent;
@@ -171,6 +173,7 @@ begin
end else begin
FoundTool.CaretToCleanPos(FoundCursorPos,FoundCleanPos);
FoundNode:=FoundTool.FindDeepestNodeAtPos(FoundCleanPos,true);
+ //debugln(['TTestFindDeclaration.FindDeclarations Found: ',FoundTool.CleanPosToStr(FoundNode.StartPos,true)]);
FoundPath:=NodeAsPath(FoundTool,FoundNode);
end;
//debugln(['TTestFindDeclaration.FindDeclarations FoundPath=',FoundPath]);
@@ -234,6 +237,11 @@ begin
FindDeclarations('fdt_basic.pas');
end;
+procedure TTestFindDeclaration.TestFindDeclaration_With;
+begin
+ FindDeclarations('fdt_with.pas');
+end;
+
procedure TTestFindDeclaration.TestFindDeclaration_NestedClasses;
begin
FindDeclarations('fdt_nestedclasses.pas');
diff --git a/components/codetools/tests/finddeclarationtest.lpi b/components/codetools/tests/finddeclarationtest.lpi
index c159cb9ed3..ec724a6341 100644
--- a/components/codetools/tests/finddeclarationtest.lpi
+++ b/components/codetools/tests/finddeclarationtest.lpi
@@ -40,7 +40,7 @@
-
+
@@ -73,6 +73,10 @@
+
+
+
+
diff --git a/components/codetools/tests/finddeclarationtest.lpr b/components/codetools/tests/finddeclarationtest.lpr
index b2c7e217a6..0b95b11acf 100644
--- a/components/codetools/tests/finddeclarationtest.lpr
+++ b/components/codetools/tests/finddeclarationtest.lpr
@@ -29,7 +29,7 @@ uses
{$IFDEF Darwin}
fdt_objccategory, fdt_objcclass,
{$ENDIF}
- fdt_basic;
+ fdt_basic, fdt_with;
const
ConfigFilename = 'codetools.config';