codetools: updated test dottedt unit name

git-svn-id: trunk@55950 -
This commit is contained in:
mattias 2017-09-30 19:20:43 +00:00
parent fb8fc48319
commit 027f9ab2e6
2 changed files with 14 additions and 5 deletions

View File

@ -8,8 +8,8 @@ uses
.nsAA{declaration:unitdots.nsA.nsAA}.nsAAA{declaration:unitdots.nsA.nsAA.nsAAA}; .nsAA{declaration:unitdots.nsA.nsAA}.nsAAA{declaration:unitdots.nsA.nsAA.nsAAA};
type type
TPrgColor = unitdots.dot.tcolor{declaration:unitdots.tcolor}; TPrgColor = dot.tcolor{declaration:unitdots.dot.tcolor};
TStrange = unitdots.tprogramdots1.tprgcolor{declaration:unitdots.tprogramdots1.tprgcolor}; TStrange = unitdots.tprogramdots1.tprgcolor{declaration:tprgcolor};
begin begin
end. end.

View File

@ -170,13 +170,19 @@ procedure TCustomTestFindDeclaration.FindDeclarations(Filename: string);
PrependPath(Tool.ExtractProcName(Node,[]),Result); PrependPath(Tool.ExtractProcName(Node,[]),Result);
ctnProperty: ctnProperty:
PrependPath(Tool.ExtractPropName(Node,false),Result); PrependPath(Tool.ExtractPropName(Node,false),Result);
ctnUseUnit:
begin
writeln('CCC1 NodeAsPath ',Node.StartPos,' ',Node.FirstChild.StartPos,'-',Node.FirstChild.EndPos);
PrependPath(Tool.ExtractUsedUnitName(Node),Result);
end;
ctnUseUnitNamespace,ctnUseUnitClearName: ctnUseUnitNamespace,ctnUseUnitClearName:
begin begin
PrependPath(GetIdentifier(@Tool.Src[Node.StartPos]),Result); PrependPath(GetIdentifier(@Tool.Src[Node.StartPos]),Result);
if Node.PriorBrother<>nil then begin if Node.PriorBrother<>nil then begin
Node:=Node.PriorBrother; Node:=Node.PriorBrother;
continue; continue;
end; end else
Node:=Node.Parent;
end; end;
//else debugln(['NodeAsPath ',Node.DescAsString]); //else debugln(['NodeAsPath ',Node.DescAsString]);
end; end;
@ -265,7 +271,7 @@ begin
if (Marker='declaration') then begin if (Marker='declaration') then begin
ExpectedPath:=copy(Src,PathPos,CommentP-1-PathPos); ExpectedPath:=copy(Src,PathPos,CommentP-1-PathPos);
{$IFDEF VerboseFindDeclarationTests} {$IFDEF VerboseFindDeclarationTests}
debugln(['TTestFindDeclaration.FindDeclarations searching "',Marker,'" at ',Tool.CleanPosToStr(NameStartPos-1),' ExpectedPath=',ExpectedPath]); debugln(['TTestFindDeclaration.FindDeclarations searching "',Marker,'" at ',MainTool.CleanPosToStr(NameStartPos-1),' ExpectedPath=',ExpectedPath]);
{$ENDIF} {$ENDIF}
MainTool.CleanPosToCaret(IdentifierStartPos,CursorPos); MainTool.CleanPosToCaret(IdentifierStartPos,CursorPos);
@ -282,13 +288,16 @@ begin
end else begin end else begin
FoundTool:=CodeToolBoss.GetCodeToolForSource(FoundCursorPos.Code,true,true) as TFindDeclarationTool; FoundTool:=CodeToolBoss.GetCodeToolForSource(FoundCursorPos.Code,true,true) as TFindDeclarationTool;
FoundPath:=''; FoundPath:='';
FoundNode:=nil;
if (FoundCursorPos.Y=1) and (FoundCursorPos.X=1) then begin if (FoundCursorPos.Y=1) and (FoundCursorPos.X=1) then begin
// unit // unit
FoundPath:=ExtractFileNameOnly(FoundCursorPos.Code.Filename); FoundPath:=ExtractFileNameOnly(FoundCursorPos.Code.Filename);
end else begin end else begin
FoundTool.CaretToCleanPos(FoundCursorPos,FoundCleanPos); FoundTool.CaretToCleanPos(FoundCursorPos,FoundCleanPos);
if (FoundCleanPos>1) and (IsIdentChar[FoundTool.Src[FoundCleanPos-1]]) then
dec(FoundCleanPos);
FoundNode:=FoundTool.FindDeepestNodeAtPos(FoundCleanPos,true); FoundNode:=FoundTool.FindDeepestNodeAtPos(FoundCleanPos,true);
//debugln(['TTestFindDeclaration.FindDeclarations Found: ',FoundTool.CleanPosToStr(FoundNode.StartPos,true)]); //debugln(['TTestFindDeclaration.FindDeclarations Found: ',FoundTool.CleanPosToStr(FoundNode.StartPos,true),' FoundNode=',FoundNode.DescAsString]);
FoundPath:=NodeAsPath(FoundTool,FoundNode); FoundPath:=NodeAsPath(FoundTool,FoundNode);
end; end;
//debugln(['TTestFindDeclaration.FindDeclarations FoundPath=',FoundPath]); //debugln(['TTestFindDeclaration.FindDeclarations FoundPath=',FoundPath]);