This commit is contained in:
Hackerpilot 2013-10-29 23:10:01 -07:00
parent 13ef990fa9
commit 506573b493
3 changed files with 112 additions and 100 deletions

View File

@ -199,7 +199,7 @@ final class FirstPass : ASTVisitor
foreach (Attribute attr; dec.attributes)
{
if (isProtection(attr.attribute))
p = attr.attribute;
protection = attr.attribute;
}
dec.accept(this);
protection = p;
@ -284,6 +284,7 @@ final class FirstPass : ASTVisitor
{
ImportInformation info;
info.modulePath = convertChainToImportPath(single.identifierChain);
info.isPublic = protection == TokenType.public_;
currentScope.importInformation ~= info;
}
if (importDeclaration.importBindings is null) return;
@ -298,6 +299,7 @@ final class FirstPass : ASTVisitor
bindTuple[1] = bind.right == TokenType.invalid ? null : bind.right.value.dup;
info.importedSymbols ~= bindTuple;
}
info.isPublic = protection == TokenType.public_;
currentScope.importInformation ~= info;
}
@ -339,7 +341,6 @@ private:
void visitAggregateDeclaration(AggType)(AggType dec, CompletionKind kind)
{
// Log.trace("visiting aggregate declaration ", dec.name.value);
SemanticSymbol* symbol = new SemanticSymbol(dec.name.value.dup,
kind, symbolFile, dec.name.startIndex);
@ -502,6 +503,11 @@ private:
if (importInfo.importedSymbols.length == 0)
{
currentScope.symbols ~= symbols;
if (importInfo.isPublic && currentScope.parent is null)
{
Log.trace("Public import");
rootSymbol.acSymbol.parts ~= symbols;
}
continue;
}
symbolLoop: foreach (symbol; symbols)
@ -522,9 +528,15 @@ private:
s.location = symbol.location;
s.symbolFile = symbol.symbolFile;
currentScope.symbols ~= s;
if (importInfo.isPublic && currentScope.parent is null)
rootSymbol.acSymbol.parts ~= s;
}
else
{
currentScope.symbols ~= symbol;
if (importInfo.isPublic && currentScope.parent is null)
rootSymbol.acSymbol.parts ~= symbol;
}
}
}
}
@ -717,7 +729,7 @@ private:
const(ACSymbol)*[] convertAstToSymbols(const(Token)[] tokens, string symbolFile)
{
Module m = parseModuleSimple(tokens, null);
Module m = parseModuleSimple(tokens, symbolFile);
FirstPass first = new FirstPass(m, symbolFile);
first.run();

@ -1 +1 @@
Subproject commit 1c057260d5541f2ebd4d5b1780bacf45e482df39
Subproject commit e3819643bbec121e16abda6f980cc096d2e7f4f1

View File

@ -69,7 +69,7 @@ struct ModuleCache
estimate = symbol.estimateMemory(estimate);
}
double megabytes = estimate / (1024.0F * 1024.0F);
Log.info("Memory use estimated at ", megabytes, " megabytes");
Log.trace("Memory use estimated at ", megabytes, " megabytes");
}
/**