Minor code cleanup
This commit is contained in:
parent
919d43f267
commit
39407aa05c
|
@ -421,7 +421,7 @@ ImportKind determineImportKind(T)(T tokens)
|
||||||
if (!(tokens[i] == tok!":" || tokens[i] == tok!"," || tokens[i] == tok!"." || tokens[i] == tok!"identifier"))
|
if (!(tokens[i] == tok!":" || tokens[i] == tok!"," || tokens[i] == tok!"." || tokens[i] == tok!"identifier"))
|
||||||
return ImportKind.neither;
|
return ImportKind.neither;
|
||||||
bool foundColon = false;
|
bool foundColon = false;
|
||||||
loop: while (true) switch (tokens[i].type)
|
while (true) switch (tokens[i].type)
|
||||||
{
|
{
|
||||||
case tok!":":
|
case tok!":":
|
||||||
foundColon = true;
|
foundColon = true;
|
||||||
|
@ -445,20 +445,17 @@ ImportKind determineImportKind(T)(T tokens)
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
Token[] t = [
|
import std.stdio : writeln;
|
||||||
Token(tok!"import"),
|
|
||||||
Token(tok!"identifier"),
|
Token[] t = [
|
||||||
Token(tok!"."),
|
Token(tok!"import"), Token(tok!"identifier"), Token(tok!"."),
|
||||||
Token(tok!"identifier"),
|
Token(tok!"identifier"), Token(tok!":"), Token(tok!"identifier"), Token(tok!",")
|
||||||
Token(tok!":"),
|
];
|
||||||
Token(tok!"identifier"),
|
assert(determineImportKind(t) == ImportKind.selective);
|
||||||
Token(tok!",")];
|
|
||||||
assert (determineImportKind(t) == ImportKind.selective);
|
|
||||||
Token[] t2;
|
Token[] t2;
|
||||||
t2 ~= Token(tok!"else");
|
t2 ~= Token(tok!"else");
|
||||||
t2 ~= Token(tok!":");
|
t2 ~= Token(tok!":");
|
||||||
assert (determineImportKind(t2) == ImportKind.neither);
|
assert(determineImportKind(t2) == ImportKind.neither);
|
||||||
import std.stdio : writeln;
|
|
||||||
writeln("Unittest for determineImportKind() passed");
|
writeln("Unittest for determineImportKind() passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,11 +816,9 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
||||||
|
|
||||||
if (completionType == CompletionType.identifiers)
|
if (completionType == CompletionType.identifiers)
|
||||||
{
|
{
|
||||||
import containers.ttree : TTree;
|
|
||||||
if (symbols[0].qualifier == SymbolQualifier.func
|
if (symbols[0].qualifier == SymbolQualifier.func
|
||||||
|| symbols[0].kind == CompletionKind.functionName)
|
|| symbols[0].kind == CompletionKind.functionName)
|
||||||
{
|
{
|
||||||
// Log.trace("Completion list for return type of function ", symbols[0].name);
|
|
||||||
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
symbols = symbols[0].type is null ? [] : [symbols[0].type];
|
||||||
if (symbols.length == 0)
|
if (symbols.length == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1021,7 +1016,7 @@ T getExpression(T)(T beforeTokens)
|
||||||
close = tok!"[";
|
close = tok!"[";
|
||||||
skip:
|
skip:
|
||||||
mixin (EXPRESSION_LOOP_BREAK);
|
mixin (EXPRESSION_LOOP_BREAK);
|
||||||
auto bookmark = i;
|
immutable bookmark = i;
|
||||||
int depth = 1;
|
int depth = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue