mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +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) {
|
if (t->kind == Type_Enum) {
|
||||||
for (isize i = 0; i < t->Enum.field_count; i++) {
|
for (isize i = 0; i < t->Enum.field_count; i++) {
|
||||||
Entity *f = t->Enum.fields[i];
|
Entity *f = t->Enum.fields[i];
|
||||||
|
if (!is_entity_exported(f)) continue;
|
||||||
|
|
||||||
Entity *found = scope_insert_entity(c->context.scope, f);
|
Entity *found = scope_insert_entity(c->context.scope, f);
|
||||||
if (found != nullptr) {
|
if (found != nullptr) {
|
||||||
gbString expr_str = expr_to_string(expr);
|
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;
|
Scope *scope = e->ImportName.scope;
|
||||||
for_array(i, scope->elements.entries) {
|
for_array(i, scope->elements.entries) {
|
||||||
Entity *decl = scope->elements.entries[i].value;
|
Entity *decl = scope->elements.entries[i].value;
|
||||||
|
if (!is_entity_exported(decl)) continue;
|
||||||
|
|
||||||
Entity *found = scope_insert_entity(c->context.scope, decl);
|
Entity *found = scope_insert_entity(c->context.scope, decl);
|
||||||
if (found != nullptr) {
|
if (found != nullptr) {
|
||||||
gbString expr_str = expr_to_string(expr);
|
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;
|
Entity *e = scope->elements.entries[elem_index].value;
|
||||||
if (e->scope == parent_scope) return;
|
if (e->scope == parent_scope) return;
|
||||||
|
|
||||||
if (!is_entity_kind_exported(e->kind)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (is_entity_exported(e)) {
|
if (is_entity_exported(e)) {
|
||||||
// TODO(bill): Should these entities be imported but cause an error when used?
|
// TODO(bill): Should these entities be imported but cause an error when used?
|
||||||
bool ok = add_entity(c, parent_scope, e->identifier, e);
|
bool ok = add_entity(c, parent_scope, e->identifier, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user