mirror of https://github.com/buggins/dlangide.git
DCD fixes; waiting for DSymbol PR
This commit is contained in:
parent
0b3530142f
commit
7560d8347c
|
@ -4,7 +4,6 @@ import dlangui.core.logger;
|
||||||
import dlangui.core.files;
|
import dlangui.core.files;
|
||||||
import dlangui.platforms.common.platform;
|
import dlangui.platforms.common.platform;
|
||||||
import ddebug.common.queue;
|
import ddebug.common.queue;
|
||||||
import dsymbol.string_interning : internString;
|
|
||||||
|
|
||||||
import core.thread;
|
import core.thread;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ class DCDTask {
|
||||||
}
|
}
|
||||||
void createRequest() {
|
void createRequest() {
|
||||||
request.sourceCode = cast(ubyte[])_content;
|
request.sourceCode = cast(ubyte[])_content;
|
||||||
request.fileName = internString(_filename);
|
request.fileName = _filename;
|
||||||
request.cursorPosition = _index;
|
request.cursorPosition = _index;
|
||||||
request.importPaths = _importPaths;
|
request.importPaths = _importPaths;
|
||||||
}
|
}
|
||||||
|
@ -82,25 +81,16 @@ class DCDTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string[] internStrings(in string[] src) {
|
|
||||||
if (!src)
|
|
||||||
return null;
|
|
||||||
string[] res;
|
|
||||||
foreach(s; src)
|
|
||||||
res ~= internString(s);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleCacheAccessor {
|
class ModuleCacheAccessor {
|
||||||
import dsymbol.modulecache;
|
import dsymbol.modulecache;
|
||||||
//protected ASTAllocator _astAllocator;
|
//protected ASTAllocator _astAllocator;
|
||||||
protected ModuleCache _moduleCache;
|
protected ModuleCache _moduleCache;
|
||||||
this(in string[] importPaths) {
|
this(in string[] importPaths) {
|
||||||
_moduleCache = ModuleCache(new SharedASTAllocator);
|
_moduleCache = ModuleCache(new SharedASTAllocator);
|
||||||
_moduleCache.addImportPaths(internStrings(importPaths));
|
_moduleCache.addImportPaths(importPaths);
|
||||||
}
|
}
|
||||||
protected ModuleCache * getModuleCache(in string[] importPaths) {
|
protected ModuleCache * getModuleCache(in string[] importPaths) {
|
||||||
_moduleCache.addImportPaths(internStrings(importPaths));
|
_moduleCache.addImportPaths(importPaths);
|
||||||
return &_moduleCache;
|
return &_moduleCache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,6 +151,7 @@ class DCDInterface : Thread {
|
||||||
|
|
||||||
void threadFunc() {
|
void threadFunc() {
|
||||||
_moduleCache = new ModuleCacheAccessor(null);
|
_moduleCache = new ModuleCacheAccessor(null);
|
||||||
|
getModuleCache(null);
|
||||||
Log.d("Starting DCD tasks thread");
|
Log.d("Starting DCD tasks thread");
|
||||||
while (!_queue.closed()) {
|
while (!_queue.closed()) {
|
||||||
DCDTask task;
|
DCDTask task;
|
||||||
|
@ -174,6 +165,7 @@ class DCDInterface : Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.d("Exiting DCD tasks thread");
|
Log.d("Exiting DCD tasks thread");
|
||||||
|
destroyModuleCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
import dsymbol.modulecache;
|
import dsymbol.modulecache;
|
||||||
|
|
Loading…
Reference in New Issue