@@ -160,10 +160,7 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
160160 }
161161
162162 void import_function (ASR::Function_t* fn) {
163- if (ASRUtils::get_FunctionType (fn)->m_abi != ASR::abiType::BindC) return ;
164- if (ASRUtils::get_FunctionType (fn)->m_deftype != ASR::deftypeType::Interface) return ;
165- if (ASRUtils::get_FunctionType (fn)->m_abi != ASR::abiType::BindC) return ;
166- if (ASRUtils::is_intrinsic_function2 (fn)) return ;
163+ if (ASRUtils::get_FunctionType (fn)->m_abi != ASR::abiType::BindJS) return ;
167164
168165 emit_function_prototype (*fn);
169166 m_wa.emit_import_fn (" js" , fn->m_name ,
@@ -1160,13 +1157,12 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
11601157 bool is_unsupported_function (const ASR::Function_t &x) {
11611158 if (strcmp (x.m_name , " _start" ) == 0 ) return false ;
11621159
1163- if (ASRUtils::get_FunctionType (x)->m_abi == ASR::abiType::BindC &&
1164- ASRUtils::get_FunctionType (x)->m_deftype == ASR::deftypeType::Interface) {
1165- if (ASRUtils::is_intrinsic_function2 (&x)) {
1166- diag.codegen_warning_label (
1167- " WASM: C Intrinsic Functions not yet supported" ,
1168- {x.base .base .loc }, std::string (x.m_name ));
1169- }
1160+ if (ASRUtils::get_FunctionType (x)->m_abi == ASR::abiType::BindJS) {
1161+ return true ;
1162+ }
1163+
1164+ if (ASRUtils::get_FunctionType (x)->m_abi == ASR::abiType::BindC) {
1165+ // Skip C Intrinsic Functions
11701166 return true ;
11711167 }
11721168 for (size_t i = 0 ; i < x.n_body ; i++) {
@@ -1175,13 +1171,8 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
11751171 ASR::Function_t *s = ASR::down_cast<ASR::Function_t>(
11761172 ASRUtils::symbol_get_past_external (sub_call.m_name ));
11771173 if (ASRUtils::get_FunctionType (s)->m_abi == ASR::abiType::BindC &&
1178- ASRUtils::get_FunctionType (s)->m_deftype == ASR::deftypeType::Interface &&
11791174 ASRUtils::is_intrinsic_function2 (s)) {
1180- diag.codegen_warning_label (
1181- " WASM: Calls to C Intrinsic Functions are not yet "
1182- " supported" ,
1183- {x.m_body [i]->base .loc },
1184- " Function: calls " + std::string (s->m_name ));
1175+ // Skip functions that call into C Intrinsic Functions
11851176 return true ;
11861177 }
11871178 }
0 commit comments