From 2accb4648b2efc8002c94ecd3125dd6d08f1f35e Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Wed, 2 Mar 2016 02:43:54 -0800 Subject: [PATCH 1/2] Update dparse and dsymbol --- dsymbol | 2 +- libdparse | 2 +- makefile | 2 ++ src/server/autocomplete.d | 22 ++++++++++++++-------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dsymbol b/dsymbol index e07b931..3bc0ee1 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit e07b931e04957a2627bfe84c3b198045e8b8041f +Subproject commit 3bc0ee1d6a403fc59c5f5926af72f5be59269a36 diff --git a/libdparse b/libdparse index 2f91d07..1bdfe95 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 2f91d07f698545ebc94ede00d5085aa59dbe38b3 +Subproject commit 1bdfe95a212ada95fec973f0335a42e495841b4a diff --git a/makefile b/makefile index 04e60c2..8f0cfa2 100644 --- a/makefile +++ b/makefile @@ -67,6 +67,8 @@ SERVER_SRC := \ ${DPARSE_DIR}/src/dparse/lexer.d\ ${DPARSE_DIR}/src/dparse/parser.d\ ${DPARSE_DIR}/src/dparse/formatter.d\ + ${DPARSE_DIR}/src/dparse/rollback_allocator.d\ + ${DPARSE_DIR}/src/dparse/stack_buffer.d\ ${DPARSE_DIR}/src/std/experimental/lexer.d\ $(shell find containers/experimental_allocator/src/std/experimental/allocator/ -name "*.d")\ containers/src/containers/dynamicarray.d\ diff --git a/src/server/autocomplete.d b/src/server/autocomplete.d index 6b47f4a..d0e9c95 100644 --- a/src/server/autocomplete.d +++ b/src/server/autocomplete.d @@ -35,6 +35,7 @@ import std.uni; import dparse.ast; import dparse.lexer; import dparse.parser; +import dparse.rollback_allocator; import dsymbol.conversion; import dsymbol.modulecache; @@ -59,10 +60,11 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request, { // trace("Getting doc comments"); AutocompleteResponse response; + RollbackAllocator rba; auto allocator = scoped!(ASTAllocator)(); auto cache = StringCache(StringCache.defaultBucketCount); SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.ddoc, - allocator, cache, moduleCache); + allocator, &rba, cache, moduleCache); if (stuff.symbols.length == 0) warning("Could not find symbol"); else @@ -121,10 +123,11 @@ public AutocompleteResponse findDeclaration(const AutocompleteRequest request, ref ModuleCache moduleCache) { AutocompleteResponse response; + RollbackAllocator rba; auto allocator = scoped!(ASTAllocator)(); auto cache = StringCache(StringCache.defaultBucketCount); SymbolStuff stuff = getSymbolsForCompletion(request, - CompletionType.location, allocator, cache, moduleCache); + CompletionType.location, allocator, &rba, cache, moduleCache); scope(exit) stuff.destroy(); if (stuff.symbols.length > 0) { @@ -191,8 +194,9 @@ public AutocompleteResponse symbolSearch(const AutocompleteRequest request, const(Token)[] tokenArray = getTokensForParser(cast(ubyte[]) request.sourceCode, config, &cache); auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - request.cursorPosition, moduleCache); + &rba, request.cursorPosition, moduleCache); scope(exit) pair.destroy(); static struct SearchResults @@ -328,8 +332,9 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray, case tok!"this": case tok!"super": auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - cursorPosition, moduleCache); + &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); response.setCompletions(pair.scope_, getExpression(beforeTokens), cursorPosition, CompletionType.identifiers, false, partial); @@ -372,14 +377,14 @@ auto getTokensBeforeCursor(const(ubyte[]) sourceCode, size_t cursorPosition, * the request's source code, cursor position, and completion type. */ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request, - const CompletionType type, IAllocator allocator, ref StringCache cache, - ref ModuleCache moduleCache) + const CompletionType type, IAllocator allocator, RollbackAllocator* rba, + ref StringCache cache, ref ModuleCache moduleCache) { const(Token)[] tokenArray; auto beforeTokens = getTokensBeforeCursor(request.sourceCode, request.cursorPosition, cache, tokenArray); ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - request.cursorPosition, moduleCache); + rba, request.cursorPosition, moduleCache); auto expression = getExpression(beforeTokens); return SymbolStuff(getSymbolsByTokenChain(pair.scope_, expression, request.cursorPosition, type), pair.symbol, pair.scope_); @@ -456,8 +461,9 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens, case tok!")": case tok!"]": auto allocator = scoped!(ASTAllocator)(); + RollbackAllocator rba; ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - cursorPosition, moduleCache); + &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); auto expression = getExpression(beforeTokens[0 .. $ - 1]); response.setCompletions(pair.scope_, expression, From 8fa98a18485c1e4bd8ac36d21e9d0637a9ec72cf Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 3 Mar 2016 02:18:28 -0800 Subject: [PATCH 2/2] Update dependencies --- dsymbol | 2 +- dub.json | 4 ++-- libdparse | 2 +- src/common/dcd_version.d | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dsymbol b/dsymbol index 3bc0ee1..86cf39c 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit 3bc0ee1d6a403fc59c5f5926af72f5be59269a36 +Subproject commit 86cf39c41e3173818a3ad9aa60bb253f0da26523 diff --git a/dub.json b/dub.json index dccc483..d4029fa 100644 --- a/dub.json +++ b/dub.json @@ -7,8 +7,8 @@ ], "license": "GPL-3.0", "dependencies": { - "dsymbol": "~>0.1.1", - "libdparse": "~>0.5.0", + "dsymbol": "~>0.2.0-alpha1", + "libdparse": "~>0.7.0-alpha1", "msgpack-d": "~>1.0.0-beta.2" }, "versions": ["built_with_dub"], diff --git a/libdparse b/libdparse index 1bdfe95..3257b3c 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 1bdfe95a212ada95fec973f0335a42e495841b4a +Subproject commit 3257b3c905127e8bccf4b9b2ebc50b9b448c0fba diff --git a/src/common/dcd_version.d b/src/common/dcd_version.d index ac7c229..085443b 100644 --- a/src/common/dcd_version.d +++ b/src/common/dcd_version.d @@ -21,7 +21,7 @@ module common.dcd_version; /** * Human-readable version number */ -enum DCD_VERSION = "v0.8.0-beta2"; +enum DCD_VERSION = "v0.9.0-alpha1"; version (Windows) {} else version (built_with_dub) {}