Use ASTAllocator again

This commit is contained in:
Per Nordlöw 2022-07-14 10:33:57 +02:00
parent 37513b9348
commit f58a84408b
5 changed files with 8 additions and 8 deletions

View File

@ -213,7 +213,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray,
mixin(TYPE_IDENT_CASES); mixin(TYPE_IDENT_CASES);
case tok!")": case tok!")":
case tok!"]": case tok!"]":
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
RollbackAllocator rba; RollbackAllocator rba;
ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator,
&rba, cursorPosition, moduleCache); &rba, cursorPosition, moduleCache);
@ -229,7 +229,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray,
case tok!";": case tok!";":
case tok!"}": case tok!"}":
case tok!",": case tok!",":
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
RollbackAllocator rba; RollbackAllocator rba;
ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator,
&rba, 1, moduleCache); &rba, 1, moduleCache);
@ -302,7 +302,7 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens,
case tok!")": case tok!")":
case tok!"]": case tok!"]":
mixin(STRING_LITERAL_CASES); mixin(STRING_LITERAL_CASES);
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
RollbackAllocator rba; RollbackAllocator rba;
ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator,
&rba, cursorPosition, moduleCache); &rba, cursorPosition, moduleCache);

View File

@ -45,7 +45,7 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
// trace("Getting doc comments"); // trace("Getting doc comments");
AutocompleteResponse response; AutocompleteResponse response;
RollbackAllocator rba; RollbackAllocator rba;
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
auto cache = StringCache(request.sourceCode.length.optimalBucketCount); auto cache = StringCache(request.sourceCode.length.optimalBucketCount);
SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.ddoc, SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.ddoc,
allocator, &rba, cache, moduleCache); allocator, &rba, cache, moduleCache);

View File

@ -45,7 +45,7 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request,
{ {
AutocompleteResponse response; AutocompleteResponse response;
RollbackAllocator rba; RollbackAllocator rba;
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
auto cache = StringCache(request.sourceCode.length.optimalBucketCount); auto cache = StringCache(request.sourceCode.length.optimalBucketCount);
// patchs the original request for the subsequent requests // patchs the original request for the subsequent requests

View File

@ -47,7 +47,7 @@ public AutocompleteResponse findDeclaration(const AutocompleteRequest request,
{ {
AutocompleteResponse response; AutocompleteResponse response;
RollbackAllocator rba; RollbackAllocator rba;
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
auto cache = StringCache(request.sourceCode.length.optimalBucketCount); auto cache = StringCache(request.sourceCode.length.optimalBucketCount);
SymbolStuff stuff = getSymbolsForCompletion(request, SymbolStuff stuff = getSymbolsForCompletion(request,
CompletionType.location, allocator, &rba, cache, moduleCache); CompletionType.location, allocator, &rba, cache, moduleCache);
@ -75,7 +75,7 @@ public AutocompleteResponse symbolSearch(const AutocompleteRequest request,
auto cache = StringCache(request.sourceCode.length.optimalBucketCount); auto cache = StringCache(request.sourceCode.length.optimalBucketCount);
const(Token)[] tokenArray = getTokensForParser(cast(ubyte[]) request.sourceCode, const(Token)[] tokenArray = getTokensForParser(cast(ubyte[]) request.sourceCode,
config, &cache); config, &cache);
scope allocator = new SymbolsAllocator(); scope allocator = new ASTAllocator();
RollbackAllocator rba; RollbackAllocator rba;
ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator,
&rba, request.cursorPosition, moduleCache); &rba, request.cursorPosition, moduleCache);

View File

@ -176,7 +176,7 @@ int runServer(string[] args)
info("Sockets shut down."); info("Sockets shut down.");
} }
ModuleCache cache = ModuleCache(new SymbolsAllocator); ModuleCache cache = ModuleCache(new ASTAllocator);
cache.addImportPaths(importPaths); cache.addImportPaths(importPaths);
infof("Import directories:\n %-(%s\n %)", cache.getImportPaths()); infof("Import directories:\n %-(%s\n %)", cache.getImportPaths());