Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b1dba3

Browse files
committed
WASM: Support importing functions declared in modules
1 parent afac7ba commit 9b1dba3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libasr/codegen/asr_to_wasm.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
189189
import_function(fn);
190190
}
191191
}
192+
} else if (ASR::is_a<ASR::Module_t>(*item.second)) {
193+
ASR::Module_t *m = ASR::down_cast<ASR::Module_t>(item.second);
194+
for (auto &item : m->m_symtab->get_scope()) {
195+
if (ASR::is_a<ASR::Function_t>(*item.second)) {
196+
ASR::Function_t *fn = ASR::down_cast<ASR::Function_t>(item.second);
197+
import_function(fn);
198+
}
199+
}
192200
} else if (ASR::is_a<ASR::Function_t>(*item.second)) {
193201
ASR::Function_t *fn = ASR::down_cast<ASR::Function_t>(item.second);
194202
import_function(fn);

0 commit comments

Comments
 (0)