Skip to content

Wasm modules initial #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ RUN(NAME test_dict_03 LABELS cpython llvm)
RUN(NAME test_dict_04 LABELS cpython llvm)
RUN(NAME test_dict_05 LABELS cpython llvm)
RUN(NAME test_for_loop LABELS cpython llvm c)
RUN(NAME modules_01 LABELS cpython llvm)
RUN(NAME modules_02 LABELS cpython llvm)
RUN(NAME modules_01 LABELS cpython llvm wasm)
RUN(NAME modules_02 LABELS cpython llvm wasm)
RUN(NAME test_import_01 LABELS cpython llvm)
RUN(NAME test_math LABELS cpython llvm)
RUN(NAME test_numpy_01 LABELS cpython llvm c)
Expand Down
18 changes: 7 additions & 11 deletions src/libasr/codegen/asr_to_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,11 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
for (auto &item : build_order) {
LFORTRAN_ASSERT(x.m_global_scope->get_scope().find(item) !=
x.m_global_scope->get_scope().end());
if (startswith(item, "lfortran_intrinsic")) {
ASR::symbol_t *mod = x.m_global_scope->get_symbol(item);
if (ASR::is_a<ASR::Module_t>(*mod)) {
ASR::Module_t *m =
ASR::down_cast<ASR::Module_t>(mod);
declare_all_functions(*(m->m_symtab));
}
ASR::symbol_t *mod = x.m_global_scope->get_symbol(item);
if (ASR::is_a<ASR::Module_t>(*mod)) {
ASR::Module_t *m =
ASR::down_cast<ASR::Module_t>(mod);
declare_all_functions(*(m->m_symtab));
}
}

Expand All @@ -296,10 +294,8 @@ class ASRToWASMVisitor : public ASR::BaseVisitor<ASRToWASMVisitor> {
for (auto &item : build_order) {
LFORTRAN_ASSERT(x.m_global_scope->get_scope().find(item) !=
x.m_global_scope->get_scope().end());
if (startswith(item, "lfortran_intrinsic")) {
ASR::symbol_t *mod = x.m_global_scope->get_symbol(item);
this->visit_symbol(*mod);
}
ASR::symbol_t *mod = x.m_global_scope->get_symbol(item);
this->visit_symbol(*mod);
}
}

Expand Down