aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-06-06 22:36:36 +0100
committergingerBill <bill@gingerbill.org>2023-06-06 22:36:36 +0100
commit356f66784f5fee819a29f1bff759fec93c9cdaed (patch)
tree8782641e47819afe17e0278a64ba79c688cd473c /src/checker.cpp
parent166ab7b60027983cf46d81df278f3132133671d7 (diff)
Fix `@(default_calling_convention)` check on wasm
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 49f2c4bb4..a9893bca4 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -3889,7 +3889,10 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
GB_ASSERT(pl->type->kind == Ast_ProcType);
auto cc = pl->type->ProcType.calling_convention;
if (cc == ProcCC_ForeignBlockDefault) {
- if (is_arch_wasm()) {
+ cc = ProcCC_CDecl;
+ if (c->foreign_context.default_cc > 0) {
+ cc = c->foreign_context.default_cc;
+ } else if (is_arch_wasm()) {
begin_error_block();
error(init, "For wasm related targets, it is required that you either define the"
" @(default_calling_convention=<string>) on the foreign block or"
@@ -3897,10 +3900,6 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) {
error_line("\tSuggestion: when dealing with normal Odin code (e.g. js_wasm32), use \"contextless\"; when dealing with Emscripten like code, use \"c\"\n");
end_error_block();
}
- cc = ProcCC_CDecl;
- if (c->foreign_context.default_cc > 0) {
- cc = c->foreign_context.default_cc;
- }
}
e->Procedure.link_prefix = c->foreign_context.link_prefix;