Add import support for remaining decl types. (#3651)

I'd excluded these initially just because I was thinking towards copies,
but under the current model I'm trying to catch all the decl types just
for consistency. Note references will still be a TODO error
(LazyImportRef is already tested for this, it just didn't feel necessary
to add individual tests while I try to sort out behavior).

Fixes an oversight where declarations in an entity's scope were being
added to the list of exports.

Note I'm trimming some Import API arguments as now-unused.
This commit is contained in:
Jon Ross-Perkins
2024-01-25 18:19:22 +00:00
committed by GitHub
parent 1f764c8cf1
commit f4a741903f
10 changed files with 230 additions and 16 deletions
+7 -1
View File
@@ -83,7 +83,13 @@ auto DeclNameStack::LookupOrAddName(NameContext name_context,
QualifiedDeclOutsideScopeEntity);
}
}
context_->AddExport(target_id);
// Exports are only tracked when the declaration is at the file-level
// scope. Otherwise, it's in some other entity, such as a class.
if (name_context.enclosing_scope == ScopeIndex::Package) {
context_->AddExport(target_id);
}
auto [_, success] = name_scope.names.insert(
{name_context.unresolved_name_id, target_id});
CARBON_CHECK(success)