mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-17 01:29:44 +00:00
Fix using on import names
This commit is contained in:
@@ -482,6 +482,8 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
|
||||
if (t->kind == Type_Enum) {
|
||||
for (isize i = 0; i < t->Enum.field_count; i++) {
|
||||
Entity *f = t->Enum.fields[i];
|
||||
if (!is_entity_exported(f)) continue;
|
||||
|
||||
Entity *found = scope_insert_entity(c->context.scope, f);
|
||||
if (found != nullptr) {
|
||||
gbString expr_str = expr_to_string(expr);
|
||||
@@ -502,6 +504,8 @@ bool check_using_stmt_entity(Checker *c, AstNodeUsingStmt *us, AstNode *expr, bo
|
||||
Scope *scope = e->ImportName.scope;
|
||||
for_array(i, scope->elements.entries) {
|
||||
Entity *decl = scope->elements.entries[i].value;
|
||||
if (!is_entity_exported(decl)) continue;
|
||||
|
||||
Entity *found = scope_insert_entity(c->context.scope, decl);
|
||||
if (found != nullptr) {
|
||||
gbString expr_str = expr_to_string(expr);
|
||||
|
||||
@@ -2521,9 +2521,6 @@ void check_add_import_decl(Checker *c, AstNodeImportDecl *id) {
|
||||
Entity *e = scope->elements.entries[elem_index].value;
|
||||
if (e->scope == parent_scope) return;
|
||||
|
||||
if (!is_entity_kind_exported(e->kind)) {
|
||||
return;
|
||||
}
|
||||
if (is_entity_exported(e)) {
|
||||
// TODO(bill): Should these entities be imported but cause an error when used?
|
||||
bool ok = add_entity(c, parent_scope, e->identifier, e);
|
||||
|
||||
Reference in New Issue
Block a user