Skip to content

Commit

Permalink
update according to code review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipul-Cariappa committed May 12, 2024
1 parent 7c4a821 commit 8b12ae4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/bin/lpython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,6 @@ int main(int argc, char *argv[])
compiler_options.use_colors = !arg_no_color;
compiler_options.indent = !arg_no_indent;


// if (fmt) {
// return format(arg_fmt_file, arg_fmt_inplace, !arg_fmt_no_color,
// arg_fmt_indent, arg_fmt_indent_unit, compiler_options);
Expand Down Expand Up @@ -1982,12 +1981,17 @@ int main(int argc, char *argv[])
}

if (arg_files.size() == 0) {
#ifdef HAVE_LFORTRAN_LLVM
lpython_pass_manager.parse_pass_arg(arg_pass, skip_pass);
lpython_pass_manager.use_default_passes();
compiler_options.po.disable_main = true;
compiler_options.emit_debug_line_column = false;
compiler_options.generate_object_code = false;
return interactive_python_repl(lpython_pass_manager, compiler_options, arg_v);
#else
std::cerr << "Interactive prompt requires the LLVM backend to be enabled. Recompile with `WITH_LLVM=yes`." << std::endl;
return 1;
#endif
}

// TODO: for now we ignore the other filenames, only handle
Expand Down
13 changes: 7 additions & 6 deletions src/lpython/python_evaluator.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#include "libasr/asr_scopes.h"
#include "lpython/python_ast.h"
#include <iostream>
#include <fstream>
#include <string>

#include <lpython/python_evaluator.h>
#include <lpython/semantics/python_ast_to_asr.h>
#include <lpython/python_ast.h>
#include <lpython/pickle.h>
#include <lpython/parser/parser.h>
#include <libasr/codegen/asr_to_cpp.h>
#include <libasr/exception.h>
#include <libasr/asr.h>
#include <lpython/pickle.h>
#include <lpython/parser/parser.h>
#include <string>
#include <libasr/asr_scopes.h>

#ifdef HAVE_LFORTRAN_LLVM
#include <libasr/codegen/evaluator.h>
Expand All @@ -31,8 +32,8 @@ PythonCompiler::PythonCompiler(CompilerOptions compiler_options)
al{1024*1024},
#ifdef HAVE_LFORTRAN_LLVM
e{std::make_unique<LLVMEvaluator>()},
eval_count{1},
#endif
eval_count{1},
compiler_options{compiler_options},
symbol_table{nullptr}
{
Expand Down
2 changes: 1 addition & 1 deletion src/lpython/python_evaluator.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class PythonCompiler
Allocator al;
#ifdef HAVE_LFORTRAN_LLVM
std::unique_ptr<LLVMEvaluator> e;
size_t eval_count;
#endif
int eval_count;
CompilerOptions compiler_options;
SymbolTable *symbol_table;
std::string run_fn;
Expand Down

0 comments on commit 8b12ae4

Please sign in to comment.