Skip to content

Commit

Permalink
Fix #195. Fix #196. Fix #197.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Feb 26, 2015
1 parent be1eb0e commit 351bf2e
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/autocomplete.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)))();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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":
Expand Down
13 changes: 11 additions & 2 deletions src/conversion/third.d
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ private:

void resolveInheritance(SemanticSymbol* currentSymbol)
{
import std.algorithm : filter;
outer: foreach (istring[] base; currentSymbol.baseClasses)
{
ACSymbol* baseClass;
Expand All @@ -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);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions tests/tc009/expected1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
calltips
this(int x)
2 changes: 2 additions & 0 deletions tests/tc009/expected2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
calltips
this(int x, int y)
2 changes: 2 additions & 0 deletions tests/tc009/expected3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
calltips
this(int x, int y)
18 changes: 18 additions & 0 deletions tests/tc009/file.d
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/tc009/run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 351bf2e

Please sign in to comment.