mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Add force usage when importing intrinsics or builtin
This commit is contained in:
+5
-1
@@ -3524,12 +3524,16 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
|
|||||||
|
|
||||||
Scope *scope = nullptr;
|
Scope *scope = nullptr;
|
||||||
|
|
||||||
|
bool force_use = false;
|
||||||
|
|
||||||
if (id->fullpath == "builtin") {
|
if (id->fullpath == "builtin") {
|
||||||
scope = builtin_pkg->scope;
|
scope = builtin_pkg->scope;
|
||||||
builtin_pkg->used = true;
|
builtin_pkg->used = true;
|
||||||
|
force_use = true;
|
||||||
} else if (id->fullpath == "intrinsics") {
|
} else if (id->fullpath == "intrinsics") {
|
||||||
scope = intrinsics_pkg->scope;
|
scope = intrinsics_pkg->scope;
|
||||||
intrinsics_pkg->used = true;
|
intrinsics_pkg->used = true;
|
||||||
|
force_use = true;
|
||||||
} else {
|
} else {
|
||||||
AstPackage **found = string_map_get(pkgs, id->fullpath);
|
AstPackage **found = string_map_get(pkgs, id->fullpath);
|
||||||
if (found == nullptr) {
|
if (found == nullptr) {
|
||||||
@@ -3575,7 +3579,7 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
|
|||||||
scope);
|
scope);
|
||||||
|
|
||||||
add_entity(ctx->checker, parent_scope, nullptr, e);
|
add_entity(ctx->checker, parent_scope, nullptr, e);
|
||||||
if (id->is_using) {
|
if (force_use || id->is_using) {
|
||||||
add_entity_use(ctx, nullptr, e);
|
add_entity_use(ctx, nullptr, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user