Fix bug with the fix to #179 and fix a problem with function declarations in imported modules

This commit is contained in:
Hackerpilot 2015-01-01 21:28:36 -08:00
parent 18198623e9
commit c693126461
3 changed files with 12 additions and 5 deletions

View File

@ -397,6 +397,9 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens,
return response; return response;
} }
/**
* Determines if an import is selective, whole-module, or neither.
*/
ImportKind determineImportKind(T)(T tokens) ImportKind determineImportKind(T)(T tokens)
{ {
assert (tokens.length > 1); assert (tokens.length > 1);

View File

@ -118,7 +118,7 @@ class SimpleParser : Parser
if (currentIs(tok!"{")) if (currentIs(tok!"{"))
skipBraces(); skipBraces();
} }
return null; return allocate!FunctionBody();
} }
} }

View File

@ -99,14 +99,18 @@ struct ModuleCache
@disable this(); @disable this();
/** /**
* Adds the given path to the list of directories checked for imports * Adds the given path to the list of directories checked for imports.
* Performs duplicate checking, so multiple instances of the same path will
* not be present.
*/ */
static void addImportPaths(string[] paths) static void addImportPaths(string[] paths)
{ {
foreach (path; paths.filter!(a => existanceCheck(a) && !importPaths[].canFind(a))) import string_interning : internString;
importPaths.insert(path); import std.array : array;
auto newPaths = paths.filter!(a => existanceCheck(a) && !importPaths[].canFind(a)).map!(internString).array;
importPaths.insert(newPaths);
foreach (path; importPaths[]) foreach (path; newPaths[])
{ {
foreach (fileName; dirEntries(path, "*.{d,di}", SpanMode.depth)) foreach (fileName; dirEntries(path, "*.{d,di}", SpanMode.depth))
{ {