Merged revision(s) 56015 #04cc3c44b2, 56028 #1e16c52819 from trunk:

Codetools: Do not chomp a procedure name with empty brackets (). Issue #31960.
........
Codetools: Add dotted unit names to uses section correctly. Optimize. Issue #32247.
........

git-svn-id: branches/fixes_1_8@56037 -
This commit is contained in:
maxim 2017-10-12 22:34:46 +00:00
parent 34d90a1c0a
commit a6ebaf4900
2 changed files with 4 additions and 6 deletions

View File

@ -1436,7 +1436,7 @@ begin
fNewMainUsesSectionUnits:=TAVLTree.Create(TListSortCompare(@CompareDottedIdentifiers));
//DebugLn(['TCodeCompletionCodeTool.AddNeededUnitToMainUsesSection AnUnitName="',AnUnitName,'"']);
if fNewMainUsesSectionUnits.Find(AnUnitName)<>nil then exit;
s:=GetIdentifier(AnUnitName);
s:=StrPas(AnUnitName);
fNewMainUsesSectionUnits.Add(Pointer(s));
Pointer(s):=nil;
end;
@ -8221,6 +8221,7 @@ begin
ReadNextAtom; // read name
if AtomIsChar(';') then break;
RemoveNewMainUsesSectionUnit(@Src[CurPos.StartPos]);
if fNewMainUsesSectionUnits.Count=0 then exit;
ReadNextAtom;
if UpAtomIs('IN') then begin
ReadNextAtom;
@ -8233,9 +8234,7 @@ begin
end;
if AtomIsChar(';') then break;
if not AtomIsChar(',') then break;
until (CurPos.StartPos>SrcLen);;
if (fNewMainUsesSectionUnits.Count=0) then exit;
until (CurPos.StartPos>SrcLen);
end;
// add units

View File

@ -1402,8 +1402,7 @@ begin
if (CurPos.Flag in [cafRoundBracketClose,cafEdgedBracketClose])
and (Src[CurPos.StartPos] = CloseBracket)
then begin
// chomp empty brackets
ExtractMemStream.Position := ExtractMemStream.Position - 1;
// opening bracket was not streamed, keep ExtractMemStream intact.
ReadNextAtom;
exit(true);
end;