Skip to content

Commit 1761077

Browse files
czgdp1807ubaidsk
authored andcommitted
upd
1 parent 0fae2c6 commit 1761077

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/lpython/semantics/python_ast_to_asr.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <complex>
1111
#include <sstream>
1212
#include <iterator>
13+
#include <cstdio>
14+
#include <cstdlib>
1315

1416
#include <libasr/asr.h>
1517
#include <libasr/asr_utils.h>
@@ -372,14 +374,22 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab,
372374
input.clear();
373375
found = set_module_path(infile0, rl_path, infile,
374376
path_used, input, ltypes, enum_py);
375-
} else{
377+
} else {
376378
if( !is_compilation_needed(infile) ) {
377379
mod1 = load_pycfile(al, input, false);
378380
fix_external_symbols(*mod1, *ASRUtils::get_tu_symtab(symtab));
379381
LFORTRAN_ASSERT(asr_verify(*mod1));
380382
compile_module = false;
381383
} else {
382384
infile.pop_back();
385+
std::string cmd = "lpython -c --disable-main " + infile;
386+
system(cmd.c_str());
387+
bool found = set_module_path(infile0c, rl_path, infile,
388+
path_used, input, ltypes, enum_py);
389+
mod1 = load_pycfile(al, input, false);
390+
fix_external_symbols(*mod1, *ASRUtils::get_tu_symtab(symtab));
391+
LFORTRAN_ASSERT(asr_verify(*mod1));
392+
compile_module = false;
383393
}
384394
}
385395

@@ -393,7 +403,14 @@ ASR::Module_t* load_module(Allocator &al, SymbolTable *symtab,
393403
if (ltypes) return nullptr;
394404

395405
if( compile_module ) {
396-
mod1 = compile_module_till_asr(al, rl_path, infile, loc, err);
406+
// mod1 = compile_module_till_asr(al, rl_path, infile, loc, err);
407+
std::string cmd = "lpython -c --disable-main " + infile;
408+
system(cmd.c_str());
409+
bool found = set_module_path(infile0c, rl_path, infile,
410+
path_used, input, ltypes, enum_py);
411+
mod1 = load_pycfile(al, input, false);
412+
fix_external_symbols(*mod1, *ASRUtils::get_tu_symtab(symtab));
413+
LFORTRAN_ASSERT(asr_verify(*mod1));
397414
}
398415

399416
// insert into `symtab`

0 commit comments

Comments
 (0)