Fix #195. Fix #196. Fix #197.

This commit is contained in:
Hackerpilot 2015-02-25 22:53:08 -08:00
parent be1eb0e983
commit 351bf2ee2d
7 changed files with 49 additions and 2 deletions

View File

@ -278,6 +278,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens,
case tok!")":
case tok!"]":
case tok!"this":
case tok!"super":
auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024*16)));
Scope* completionScope = generateAutocompleteTrees(tokenArray, allocator);
scope(exit) typeid(Scope).destroy(completionScope);
@ -387,6 +388,8 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens,
case tok!"uintLiteral":
case tok!"ulongLiteral":
case tok!"wstringLiteral":
case tok!"this":
case tok!"super":
case tok!")":
case tok!"]":
auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024 * 16)))();
@ -685,6 +688,7 @@ ACSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
case tok!"ireal":
case tok!"creal":
case tok!"this":
case tok!"super":
symbols = symbols[0].getPartsByName(internString(str(tokens[i].type)));
if (symbols.length == 0)
break loop;
@ -952,6 +956,7 @@ private enum TYPE_IDENT_AND_LITERAL_CASES = q{
case tok!"ireal":
case tok!"creal":
case tok!"this":
case tok!"super":
case tok!"identifier":
case tok!"stringLiteral":
case tok!"wstringLiteral":

View File

@ -152,6 +152,7 @@ private:
void resolveInheritance(SemanticSymbol* currentSymbol)
{
import std.algorithm : filter;
outer: foreach (istring[] base; currentSymbol.baseClasses)
{
ACSymbol* baseClass;
@ -170,8 +171,16 @@ private:
continue outer;
baseClass = symbols[0];
}
currentSymbol.acSymbol.parts.insert(baseClass.parts[]);
symbolScope.symbols.insert(baseClass.parts[]);
currentSymbol.acSymbol.parts.insert(baseClass.parts[].filter!(
a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr));
symbolScope.symbols.insert(baseClass.parts[].filter!(
a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr));
if (baseClass.kind == CompletionKind.className)
{
auto s = allocate!ACSymbol(symbolAllocator,
SUPER_SYMBOL_NAME, CompletionKind.variableName, baseClass);
symbolScope.symbols.insert(s);
}
}
}

View File

@ -0,0 +1,2 @@
calltips
this(int x)

View File

@ -0,0 +1,2 @@
calltips
this(int x, int y)

View File

@ -0,0 +1,2 @@
calltips
this(int x, int y)

18
tests/tc009/file.d Normal file
View File

@ -0,0 +1,18 @@
class Alpha
{
this(int x);
}
class Beta : Alpha
{
this(int x, int y)
{
super();
this();
}
}
void main(string[] args)
{
auto b = new Beta();
}

9
tests/tc009/run.sh Executable file
View File

@ -0,0 +1,9 @@
set -e
set -u
dcd-client file.d -c83 > actual1.txt
dcd-client file.d -c93 > actual2.txt
dcd-client file.d -c148 > actual3.txt
diff actual1.txt expected1.txt
diff actual2.txt expected2.txt
diff actual3.txt expected3.txt