Skip to content

Commit 8b12ae4

Browse files
update according to code review suggestion
1 parent 7c4a821 commit 8b12ae4

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/bin/lpython.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,6 @@ int main(int argc, char *argv[])
19351935
compiler_options.use_colors = !arg_no_color;
19361936
compiler_options.indent = !arg_no_indent;
19371937

1938-
19391938
// if (fmt) {
19401939
// return format(arg_fmt_file, arg_fmt_inplace, !arg_fmt_no_color,
19411940
// arg_fmt_indent, arg_fmt_indent_unit, compiler_options);
@@ -1982,12 +1981,17 @@ int main(int argc, char *argv[])
19821981
}
19831982

19841983
if (arg_files.size() == 0) {
1984+
#ifdef HAVE_LFORTRAN_LLVM
19851985
lpython_pass_manager.parse_pass_arg(arg_pass, skip_pass);
19861986
lpython_pass_manager.use_default_passes();
19871987
compiler_options.po.disable_main = true;
19881988
compiler_options.emit_debug_line_column = false;
19891989
compiler_options.generate_object_code = false;
19901990
return interactive_python_repl(lpython_pass_manager, compiler_options, arg_v);
1991+
#else
1992+
std::cerr << "Interactive prompt requires the LLVM backend to be enabled. Recompile with `WITH_LLVM=yes`." << std::endl;
1993+
return 1;
1994+
#endif
19911995
}
19921996

19931997
// TODO: for now we ignore the other filenames, only handle

src/lpython/python_evaluator.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
#include "libasr/asr_scopes.h"
2-
#include "lpython/python_ast.h"
31
#include <iostream>
2+
#include <fstream>
3+
#include <string>
44

55
#include <lpython/python_evaluator.h>
66
#include <lpython/semantics/python_ast_to_asr.h>
7+
#include <lpython/python_ast.h>
8+
#include <lpython/pickle.h>
9+
#include <lpython/parser/parser.h>
710
#include <libasr/codegen/asr_to_cpp.h>
811
#include <libasr/exception.h>
912
#include <libasr/asr.h>
10-
#include <lpython/pickle.h>
11-
#include <lpython/parser/parser.h>
12-
#include <string>
13+
#include <libasr/asr_scopes.h>
1314

1415
#ifdef HAVE_LFORTRAN_LLVM
1516
#include <libasr/codegen/evaluator.h>
@@ -31,8 +32,8 @@ PythonCompiler::PythonCompiler(CompilerOptions compiler_options)
3132
al{1024*1024},
3233
#ifdef HAVE_LFORTRAN_LLVM
3334
e{std::make_unique<LLVMEvaluator>()},
34-
eval_count{1},
3535
#endif
36+
eval_count{1},
3637
compiler_options{compiler_options},
3738
symbol_table{nullptr}
3839
{

src/lpython/python_evaluator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class PythonCompiler
7171
Allocator al;
7272
#ifdef HAVE_LFORTRAN_LLVM
7373
std::unique_ptr<LLVMEvaluator> e;
74-
size_t eval_count;
7574
#endif
75+
int eval_count;
7676
CompilerOptions compiler_options;
7777
SymbolTable *symbol_table;
7878
std::string run_fn;

0 commit comments

Comments
 (0)