Correct foreign import prefix behaviour for wasm

This commit is contained in:
gingerBill
2022-05-06 11:16:24 +01:00
parent 6f20b5bb59
commit 53c70da0b8
+1 -3
View File
@@ -1018,9 +1018,8 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
} }
Entity *foreign_library = init_entity_foreign_library(ctx, e); Entity *foreign_library = init_entity_foreign_library(ctx, e);
if (is_arch_wasm()) { if (is_arch_wasm() && foreign_library != nullptr) {
String module_name = str_lit("env"); String module_name = str_lit("env");
if (foreign_library != nullptr) {
GB_ASSERT (foreign_library->kind == Entity_LibraryName); GB_ASSERT (foreign_library->kind == Entity_LibraryName);
if (foreign_library->LibraryName.paths.count != 1) { if (foreign_library->LibraryName.paths.count != 1) {
error(foreign_library->token, "'foreign import' for '%.*s' architecture may only have one path, got %td", error(foreign_library->token, "'foreign import' for '%.*s' architecture may only have one path, got %td",
@@ -1030,7 +1029,6 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
if (foreign_library->LibraryName.paths.count >= 1) { if (foreign_library->LibraryName.paths.count >= 1) {
module_name = foreign_library->LibraryName.paths[0]; module_name = foreign_library->LibraryName.paths[0];
} }
}
name = concatenate3_strings(permanent_allocator(), module_name, WASM_MODULE_NAME_SEPARATOR, name); name = concatenate3_strings(permanent_allocator(), module_name, WASM_MODULE_NAME_SEPARATOR, name);
} }