Fix #11
This commit is contained in:
parent
13ef990fa9
commit
506573b493
|
@ -199,7 +199,7 @@ final class FirstPass : ASTVisitor
|
||||||
foreach (Attribute attr; dec.attributes)
|
foreach (Attribute attr; dec.attributes)
|
||||||
{
|
{
|
||||||
if (isProtection(attr.attribute))
|
if (isProtection(attr.attribute))
|
||||||
p = attr.attribute;
|
protection = attr.attribute;
|
||||||
}
|
}
|
||||||
dec.accept(this);
|
dec.accept(this);
|
||||||
protection = p;
|
protection = p;
|
||||||
|
@ -284,6 +284,7 @@ final class FirstPass : ASTVisitor
|
||||||
{
|
{
|
||||||
ImportInformation info;
|
ImportInformation info;
|
||||||
info.modulePath = convertChainToImportPath(single.identifierChain);
|
info.modulePath = convertChainToImportPath(single.identifierChain);
|
||||||
|
info.isPublic = protection == TokenType.public_;
|
||||||
currentScope.importInformation ~= info;
|
currentScope.importInformation ~= info;
|
||||||
}
|
}
|
||||||
if (importDeclaration.importBindings is null) return;
|
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;
|
bindTuple[1] = bind.right == TokenType.invalid ? null : bind.right.value.dup;
|
||||||
info.importedSymbols ~= bindTuple;
|
info.importedSymbols ~= bindTuple;
|
||||||
}
|
}
|
||||||
|
info.isPublic = protection == TokenType.public_;
|
||||||
currentScope.importInformation ~= info;
|
currentScope.importInformation ~= info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +341,6 @@ private:
|
||||||
|
|
||||||
void visitAggregateDeclaration(AggType)(AggType dec, CompletionKind kind)
|
void visitAggregateDeclaration(AggType)(AggType dec, CompletionKind kind)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Log.trace("visiting aggregate declaration ", dec.name.value);
|
// Log.trace("visiting aggregate declaration ", dec.name.value);
|
||||||
SemanticSymbol* symbol = new SemanticSymbol(dec.name.value.dup,
|
SemanticSymbol* symbol = new SemanticSymbol(dec.name.value.dup,
|
||||||
kind, symbolFile, dec.name.startIndex);
|
kind, symbolFile, dec.name.startIndex);
|
||||||
|
@ -502,6 +503,11 @@ private:
|
||||||
if (importInfo.importedSymbols.length == 0)
|
if (importInfo.importedSymbols.length == 0)
|
||||||
{
|
{
|
||||||
currentScope.symbols ~= symbols;
|
currentScope.symbols ~= symbols;
|
||||||
|
if (importInfo.isPublic && currentScope.parent is null)
|
||||||
|
{
|
||||||
|
Log.trace("Public import");
|
||||||
|
rootSymbol.acSymbol.parts ~= symbols;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
symbolLoop: foreach (symbol; symbols)
|
symbolLoop: foreach (symbol; symbols)
|
||||||
|
@ -522,9 +528,15 @@ private:
|
||||||
s.location = symbol.location;
|
s.location = symbol.location;
|
||||||
s.symbolFile = symbol.symbolFile;
|
s.symbolFile = symbol.symbolFile;
|
||||||
currentScope.symbols ~= s;
|
currentScope.symbols ~= s;
|
||||||
|
if (importInfo.isPublic && currentScope.parent is null)
|
||||||
|
rootSymbol.acSymbol.parts ~= s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
currentScope.symbols ~= symbol;
|
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)
|
const(ACSymbol)*[] convertAstToSymbols(const(Token)[] tokens, string symbolFile)
|
||||||
{
|
{
|
||||||
Module m = parseModuleSimple(tokens, null);
|
Module m = parseModuleSimple(tokens, symbolFile);
|
||||||
|
|
||||||
FirstPass first = new FirstPass(m, symbolFile);
|
FirstPass first = new FirstPass(m, symbolFile);
|
||||||
first.run();
|
first.run();
|
||||||
|
|
2
dscanner
2
dscanner
|
@ -1 +1 @@
|
||||||
Subproject commit 1c057260d5541f2ebd4d5b1780bacf45e482df39
|
Subproject commit e3819643bbec121e16abda6f980cc096d2e7f4f1
|
|
@ -69,7 +69,7 @@ struct ModuleCache
|
||||||
estimate = symbol.estimateMemory(estimate);
|
estimate = symbol.estimateMemory(estimate);
|
||||||
}
|
}
|
||||||
double megabytes = estimate / (1024.0F * 1024.0F);
|
double megabytes = estimate / (1024.0F * 1024.0F);
|
||||||
Log.info("Memory use estimated at ", megabytes, " megabytes");
|
Log.trace("Memory use estimated at ", megabytes, " megabytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue