Skip to content

Commit 351bf2e

Browse files
committed
Fix #195. Fix #196. Fix #197.
1 parent be1eb0e commit 351bf2e

File tree

7 files changed

+49
-2
lines changed

7 files changed

+49
-2
lines changed

src/autocomplete.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens,
278278
case tok!")":
279279
case tok!"]":
280280
case tok!"this":
281+
case tok!"super":
281282
auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024*16)));
282283
Scope* completionScope = generateAutocompleteTrees(tokenArray, allocator);
283284
scope(exit) typeid(Scope).destroy(completionScope);
@@ -387,6 +388,8 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens,
387388
case tok!"uintLiteral":
388389
case tok!"ulongLiteral":
389390
case tok!"wstringLiteral":
391+
case tok!"this":
392+
case tok!"super":
390393
case tok!")":
391394
case tok!"]":
392395
auto allocator = scoped!(CAllocatorImpl!(BlockAllocator!(1024 * 16)))();
@@ -685,6 +688,7 @@ ACSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope,
685688
case tok!"ireal":
686689
case tok!"creal":
687690
case tok!"this":
691+
case tok!"super":
688692
symbols = symbols[0].getPartsByName(internString(str(tokens[i].type)));
689693
if (symbols.length == 0)
690694
break loop;
@@ -952,6 +956,7 @@ private enum TYPE_IDENT_AND_LITERAL_CASES = q{
952956
case tok!"ireal":
953957
case tok!"creal":
954958
case tok!"this":
959+
case tok!"super":
955960
case tok!"identifier":
956961
case tok!"stringLiteral":
957962
case tok!"wstringLiteral":

src/conversion/third.d

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ private:
152152

153153
void resolveInheritance(SemanticSymbol* currentSymbol)
154154
{
155+
import std.algorithm : filter;
155156
outer: foreach (istring[] base; currentSymbol.baseClasses)
156157
{
157158
ACSymbol* baseClass;
@@ -170,8 +171,16 @@ private:
170171
continue outer;
171172
baseClass = symbols[0];
172173
}
173-
currentSymbol.acSymbol.parts.insert(baseClass.parts[]);
174-
symbolScope.symbols.insert(baseClass.parts[]);
174+
currentSymbol.acSymbol.parts.insert(baseClass.parts[].filter!(
175+
a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr));
176+
symbolScope.symbols.insert(baseClass.parts[].filter!(
177+
a => a.name.ptr != CONSTRUCTOR_SYMBOL_NAME.ptr));
178+
if (baseClass.kind == CompletionKind.className)
179+
{
180+
auto s = allocate!ACSymbol(symbolAllocator,
181+
SUPER_SYMBOL_NAME, CompletionKind.variableName, baseClass);
182+
symbolScope.symbols.insert(s);
183+
}
175184
}
176185
}
177186

tests/tc009/expected1.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
calltips
2+
this(int x)

tests/tc009/expected2.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
calltips
2+
this(int x, int y)

tests/tc009/expected3.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
calltips
2+
this(int x, int y)

tests/tc009/file.d

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Alpha
2+
{
3+
this(int x);
4+
}
5+
6+
class Beta : Alpha
7+
{
8+
this(int x, int y)
9+
{
10+
super();
11+
this();
12+
}
13+
}
14+
15+
void main(string[] args)
16+
{
17+
auto b = new Beta();
18+
}

tests/tc009/run.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set -e
2+
set -u
3+
4+
dcd-client file.d -c83 > actual1.txt
5+
dcd-client file.d -c93 > actual2.txt
6+
dcd-client file.d -c148 > actual3.txt
7+
diff actual1.txt expected1.txt
8+
diff actual2.txt expected2.txt
9+
diff actual3.txt expected3.txt

0 commit comments

Comments
 (0)