codetools: TCodeToolManager.GetMainCode: if FindCodeOfMainUnitHint fails, use the source directly

git-svn-id: trunk@33777 -
This commit is contained in:
mattias 2011-11-25 10:04:42 +00:00
parent c48066b140
commit d3a1c4c3e8

View File

@ -1243,9 +1243,9 @@ begin
Result:=NewFile;
end;
if (not FilenameHasSourceExt(Result.Filename)) then begin
Result:=FindCodeOfMainUnitHint(Result);
NewFile:=FindCodeOfMainUnitHint(Result);
if NewFile<>nil then Result:=NewFile;
end;
if Result=nil then exit;
CreateScanner(Result);
end;
@ -1306,6 +1306,7 @@ begin
if Code=nil then exit;
//DebugLn('TCodeToolManager.FindCodeOfMainUnitHint ',Code.Filename);
if not FindMainUnitHint(Code.Source,MainUnitFilename) then exit;
if MainUnitFilename='' then exit;
MainUnitFilename:=TrimFilename(MainUnitFilename);
if (not FilenameIsAbsolute(MainUnitFilename))
and (not Code.IsVirtual) then