include custom object modules

This commit is contained in:
ryuukk 2022-10-19 18:04:50 +02:00 committed by GitHub
parent abb29d12f3
commit 0e27404baf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 22 deletions

View File

@ -359,28 +359,31 @@ final class FirstPass : ASTVisitor
dec.accept(this);
}
override void visit(const Module mod)
{
rootSymbol = allocateSemanticSymbol(null, CompletionKind.moduleName,
symbolFile);
currentSymbol = rootSymbol;
moduleScope = GCAllocator.instance.make!Scope(0, uint.max);
currentScope = moduleScope;
auto objectLocation = cache.resolveImportLocation("object");
if (objectLocation is null)
warning("Could not locate object.d or object.di");
else
{
auto objectImport = allocateSemanticSymbol(IMPORT_SYMBOL_NAME,
CompletionKind.importSymbol, objectLocation);
objectImport.acSymbol.skipOver = true;
currentSymbol.addChild(objectImport, true);
currentScope.addSymbol(objectImport.acSymbol, false);
}
foreach (s; builtinSymbols[])
currentScope.addSymbol(s, false);
mod.accept(this);
}
override void visit(const Module mod)
{
rootSymbol = allocateSemanticSymbol(null, CompletionKind.moduleName,
symbolFile);
currentSymbol = rootSymbol;
moduleScope = GCAllocator.instance.make!Scope(0, uint.max);
currentScope = moduleScope;
auto objectLocations = cache.resolveImportLocations("object");
if (objectLocations is null)
warning("Could not locate object.d or object.di");
else
{
foreach (objectLocation; objectLocations)
{
auto objectImport = allocateSemanticSymbol(IMPORT_SYMBOL_NAME,
CompletionKind.importSymbol, objectLocation);
objectImport.acSymbol.skipOver = true;
currentSymbol.addChild(objectImport, true);
currentScope.addSymbol(objectImport.acSymbol, false);
}
}
foreach (s; builtinSymbols[])
currentScope.addSymbol(s, false);
mod.accept(this);
}
override void visit(const EnumDeclaration dec)
{