diff --git a/lazproj/coedit.lpi b/lazproj/coedit.lpi index 47c740d1..93bd9548 100644 --- a/lazproj/coedit.lpi +++ b/lazproj/coedit.lpi @@ -226,7 +226,7 @@ - + @@ -492,6 +492,10 @@ + + + + diff --git a/lazproj/coedit.lpr b/lazproj/coedit.lpr index a12b7668..30afd90d 100644 --- a/lazproj/coedit.lpr +++ b/lazproj/coedit.lpr @@ -11,7 +11,8 @@ uses ce_writableComponent, ce_staticmacro, ce_inspectors, ce_editoroptions, ce_dockoptions, ce_shortcutseditor, ce_mru, ce_processes, ce_dubproject, ce_dialogs, ce_dubprojeditor, ce_controls, ce_dfmt, ce_lcldragdrop, - ce_stringrange, ce_dlangmaps, ce_projgroup, ce_projutils, ce_d2synpresets; + ce_stringrange, ce_dlangmaps, ce_projgroup, ce_projutils, ce_d2synpresets, + ce_dastworx; {$R *.res} diff --git a/src/ce_libman.pas b/src/ce_libman.pas index cfe8c7fa..391ea0f8 100644 --- a/src/ce_libman.pas +++ b/src/ce_libman.pas @@ -5,8 +5,9 @@ unit ce_libman; interface uses - Classes, SysUtils, FileUtil, ce_common, ce_writableComponent, ce_dcd, LazFileUtils, - ce_dialogs, ce_projutils, ce_interfaces, ce_dlang, ghashmap, ghashset; + Classes, SysUtils, FileUtil, ce_common, ce_writableComponent, LazFileUtils, + ghashmap, ghashset, process, + ce_dcd, ce_dialogs, ce_projutils, ce_interfaces, ce_dlang, ce_dastworx; type @@ -220,11 +221,11 @@ end; procedure TLibraryItem.updateModulesInfo; var prj: ICECommonProject; - tks: TLexTokenList; str: TStringList; - lst: TStringList; - mdi: TModuleInfo; + mdi: TModuleInfo = nil; + fls: string = ''; fle: string; + lne: string; i: integer; begin fModules.Clear; @@ -233,52 +234,70 @@ begin if hasValidLibProject then begin prj := loadProject(fLibProject, true); - tks := TLexTokenList.Create; str := TStringList.Create; try for i:= 0 to prj.sourcesCount-1 do begin fle := prj.sourceAbsolute(i); - // note: in CE, object files are considered as source since they're taken in the cmdline file list if not hasDlangSyntax(fle.extractFileExt) then continue; - str.LoadFromFile(fle); - lex(str.Text, tks, nil, [lxoNoComments]); - mdi := addModuleInfo; - mdi.name := getModuleName(tks); - fModulesByName.insert(mdi.name, mdi); - getImports(tks, mdi.imports); - tks.Clear; + fls += fle; + if i <> prj.sourcesCount-1 then + fls += PathSeparator; + end; + getModulesImports(fls, str); + for i := 0 to str.Count-1 do + begin + lne := str[i]; + if lne[1] = '"' then + begin + lne := lne[2..lne.length-1]; + mdi := addModuleInfo; + mdi.name:= lne; + fModulesByName.insert(lne, mdi); + end else + begin + if not lne.isEmpty and mdi.isNotNil then + mdi.imports.Add(lne); + end; end; finally - tks.Free; str.Free; prj.getProject.Free; end; end else if hasValidLibSourcePath then begin - lst := TStringList.Create; str := TStringList.Create; - tks := TLexTokenList.Create; try - listFiles(lst, fLibSourcePath, true); - for i := 0 to lst.Count-1 do + listFiles(str, fLibSourcePath, true); + for i:= 0 to str.Count-1 do begin - fle := lst[i]; + fle := str[i]; if not hasDlangSyntax(fle.extractFileExt) then continue; - str.LoadFromFile(fle); - lex(str.Text, tks, nil, [lxoNoComments]); - mdi := addModuleInfo; - mdi.name := getModuleName(tks); - fModulesByName.insert(mdi.name, mdi); - getImports(tks, mdi.imports); - tks.Clear; + fls += fle; + if i <> str.Count-1 then + fls += PathSeparator; + end; + str.Clear; + getModulesImports(fls, str); + for i := 0 to str.Count-1 do + begin + lne := str[i]; + if lne[1] = '"' then + begin + lne := lne[2..lne.length-1]; + mdi := addModuleInfo; + mdi.name:= lne; + fModulesByName.insert(lne, mdi); + end else + begin + if not lne.isEmpty and mdi.isNotNil then + mdi.imports.Add(lne); + end; end; finally - lst.Free; str.Free; - tks.Free; end; end; end;