From 9f82460b7b623c652ff3efa4bd2c6a64ed95151d Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 30 Aug 2011 16:00:51 +0000 Subject: [PATCH] codetools: TStandardCodeTool.UsesSectionToFilenames: dotted names git-svn-id: trunk@32116 - --- components/codetools/stdcodetools.pas | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index 2b23e3c36f..ebdebf1b97 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -124,8 +124,8 @@ type ImplementationUsesSection: TStrings): boolean; function FindDelphiProjectUnits(var FoundInUnits, MissingInUnits, NormalUnits: TStrings; - UseContainsSection: boolean = false): boolean; // ToDo: dotted - function UsesSectionToFilenames(UsesNode: TCodeTreeNode): TStrings; // ToDo: dotted + UseContainsSection: boolean = false): boolean; + function UsesSectionToFilenames(UsesNode: TCodeTreeNode): TStrings; function UsesSectionToUnitnames(UsesNode: TCodeTreeNode): TStrings; // ToDo: dotted function FindMissingUnits(var MissingUnits: TStrings; FixCase: boolean; SearchImplementation: boolean; @@ -1390,23 +1390,17 @@ end; function TStandardCodeTool.UsesSectionToFilenames(UsesNode: TCodeTreeNode ): TStrings; var - InAtom, UnitNameAtom: TAtomPosition; AnUnitName, AnUnitInFilename: string; NewCode: TCodeBuffer; UnitFilename: string; + Node: TCodeTreeNode; begin Result:=TStringList.Create; if UsesNode=nil then exit; - MoveCursorToUsesEnd(UsesNode); - repeat - // read prior unit name - ReadPriorUsedUnit(UnitNameAtom, InAtom); - AnUnitName:=GetAtom(UnitNameAtom); - if InAtom.StartPos>0 then - AnUnitInFilename:=copy(Src,InAtom.StartPos+1, - InAtom.EndPos-InAtom.StartPos-2) - else - AnUnitInFilename:=''; + Node:=UsesNode.LastChild; + while Node<>nil do begin + // read unit name + AnUnitName:=ExtractUsedUnitName(Node,@AnUnitInFilename); // find unit file NewCode:=FindUnitSource(AnUnitName,AnUnitInFilename,false); if (NewCode=nil) then begin @@ -1420,9 +1414,8 @@ begin end; // add filename to list Result.AddObject(UnitFilename,NewCode); - // read keyword 'uses' or comma - ReadPriorAtom; - until not AtomIsChar(','); + Node:=Node.PriorBrother; + end; end; function TStandardCodeTool.UsesSectionToUnitnames(UsesNode: TCodeTreeNode