@@ -810,19 +810,20 @@ int interactive_python_repl(
810
810
LCompilers::LocationManager lm;
811
811
std::vector<std::pair<std::string, double >> times;
812
812
LCompilers::PythonCompiler::EvalResult r;
813
-
813
+
814
814
std::string code_string;
815
815
std::cout << " >>> " ;
816
816
size_t cell_count = 0 ;
817
817
for (std::string input; std::getline (std::cin, input);) {
818
- if (input == " exit" || input == " quit" ) // exit condition
818
+ if (input == " exit" || input == " quit" ) {
819
819
return 0 ;
820
+ }
820
821
821
- if ((input.rfind (" def" , 0 ) == 0 ) ||
822
- (input.rfind (" for" , 0 ) == 0 ) ||
823
- (input.rfind (" if" , 0 ) == 0 ) ||
824
- (input.rfind (" else" , 0 ) == 0 ) ||
825
- (input.rfind (" elif" , 0 ) == 0 ) ||
822
+ if ((input.rfind (" def" , 0 ) == 0 ) ||
823
+ (input.rfind (" for" , 0 ) == 0 ) ||
824
+ (input.rfind (" if" , 0 ) == 0 ) ||
825
+ (input.rfind (" else" , 0 ) == 0 ) ||
826
+ (input.rfind (" elif" , 0 ) == 0 ) ||
826
827
(input.rfind (" class" , 0 ) == 0 ) ||
827
828
(input.rfind (' @' , 0 ) == 0 ) ||
828
829
(input.rfind (' ' , 0 ) == 0 ) ||
@@ -859,11 +860,11 @@ int interactive_python_repl(
859
860
std::cout << " >>> " ;
860
861
continue ;
861
862
}
862
-
863
+
863
864
auto evaluation_end_time = std::chrono::high_resolution_clock::now ();
864
865
times.push_back (std::make_pair (" evalution " + std::to_string (cell_count), std::chrono::duration
865
866
<double , std::milli>(evaluation_start_time - evaluation_end_time).count ()));
866
-
867
+
867
868
} catch (const LCompilers::LCompilersException &e) {
868
869
std::cerr << " Internal Compiler Error: Unhandled exception" << std::endl;
869
870
std::vector<LCompilers::StacktraceItem> d = e.stacktrace_addresses ();
@@ -1934,8 +1935,6 @@ int main(int argc, char *argv[])
1934
1935
compiler_options.use_colors = !arg_no_color;
1935
1936
compiler_options.indent = !arg_no_indent;
1936
1937
1937
- lpython_pass_manager.parse_pass_arg (arg_pass, skip_pass);
1938
- lpython_pass_manager.use_default_passes ();
1939
1938
1940
1939
// if (fmt) {
1941
1940
// return format(arg_fmt_file, arg_fmt_inplace, !arg_fmt_no_color,
@@ -1983,6 +1982,8 @@ int main(int argc, char *argv[])
1983
1982
}
1984
1983
1985
1984
if (arg_files.size () == 0 ) {
1985
+ lpython_pass_manager.parse_pass_arg (arg_pass, skip_pass);
1986
+ lpython_pass_manager.use_default_passes ();
1986
1987
compiler_options.po .disable_main = true ;
1987
1988
compiler_options.emit_debug_line_column = false ;
1988
1989
compiler_options.generate_object_code = false ;
@@ -2029,6 +2030,7 @@ int main(int argc, char *argv[])
2029
2030
// return emit_c_preprocessor(arg_file, compiler_options);
2030
2031
// }
2031
2032
2033
+ lpython_pass_manager.parse_pass_arg (arg_pass, skip_pass);
2032
2034
if (show_tokens) {
2033
2035
return emit_tokens (arg_file, true , compiler_options);
2034
2036
}
@@ -2070,6 +2072,7 @@ int main(int argc, char *argv[])
2070
2072
return 1 ;
2071
2073
#endif
2072
2074
}
2075
+ lpython_pass_manager.use_default_passes ();
2073
2076
if (show_llvm) {
2074
2077
#ifdef HAVE_LFORTRAN_LLVM
2075
2078
return emit_llvm (arg_file, runtime_library_dir, lpython_pass_manager, compiler_options);
0 commit comments