trying to fix #203

This commit is contained in:
Vadim Lopatin 2017-08-10 17:41:04 +03:00
parent 55fee46ab6
commit 9647069fc3
1 changed files with 13 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import dlangui.core.logger;
import dlangui.core.files;
import dlangui.platforms.common.platform;
import ddebug.common.queue;
import dsymbol.string_interning : internString;
import core.thread;
@ -47,7 +48,7 @@ class DCDTask {
}
void createRequest() {
request.sourceCode = cast(ubyte[])_content;
request.fileName = _filename;
request.fileName = internString(_filename);
request.cursorPosition = _index;
request.importPaths = _importPaths;
}
@ -70,16 +71,25 @@ class DCDTask {
}
}
string[] internStrings(in string[] src) {
if (!src)
return null;
string[] res;
foreach(s; src)
res ~= internString(s);
return res;
}
class ModuleCacheAccessor {
import dsymbol.modulecache;
//protected ASTAllocator _astAllocator;
protected ModuleCache _moduleCache;
this(in string[] importPaths) {
_moduleCache = ModuleCache(new ASTAllocator);
_moduleCache.addImportPaths(importPaths);
_moduleCache.addImportPaths(internStrings(importPaths));
}
protected ModuleCache * getModuleCache(in string[] importPaths) {
_moduleCache.addImportPaths(importPaths);
_moduleCache.addImportPaths(internStrings(importPaths));
return &_moduleCache;
}
}