@@ -164,7 +164,7 @@ int emit_asr(const std::string &infile,
164
164
165
165
diagnostics.diagnostics .clear ();
166
166
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
167
- r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
167
+ r = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
168
168
std::cerr << diagnostics.render (input, lm, compiler_options);
169
169
if (!r.ok ) {
170
170
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -206,7 +206,7 @@ int emit_cpp(const std::string &infile,
206
206
207
207
diagnostics.diagnostics .clear ();
208
208
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
209
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
209
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
210
210
std::cerr << diagnostics.render (input, lm, compiler_options);
211
211
if (!r1.ok ) {
212
212
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -246,7 +246,7 @@ int emit_c(const std::string &infile,
246
246
247
247
diagnostics.diagnostics .clear ();
248
248
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
249
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
249
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
250
250
std::cerr << diagnostics.render (input, lm, compiler_options);
251
251
if (!r1.ok ) {
252
252
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -286,7 +286,7 @@ int emit_wat(const std::string &infile,
286
286
287
287
diagnostics.diagnostics .clear ();
288
288
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
289
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
289
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
290
290
std::cerr << diagnostics.render (input, lm, compiler_options);
291
291
if (!r1.ok ) {
292
292
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -329,7 +329,7 @@ int get_symbols (const std::string &infile,
329
329
if (r1.ok ) {
330
330
LFortran::LPython::AST::ast_t * ast = r1.result ;
331
331
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
332
- x = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
332
+ x = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
333
333
if (!x.ok ) {
334
334
std::cout << " {}\n " ;
335
335
return 0 ;
@@ -421,7 +421,7 @@ int get_errors (const std::string &infile,
421
421
if (r1.ok ) {
422
422
LFortran::LPython::AST::ast_t * ast = r1.result ;
423
423
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
424
- r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
424
+ r = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
425
425
}
426
426
std::vector<LFortran::LPython::error_highlight> diag_lists;
427
427
LFortran::LPython::error_highlight h;
@@ -532,7 +532,7 @@ int emit_llvm(const std::string &infile,
532
532
LFortran::LPython::AST::ast_t * ast = r.result ;
533
533
diagnostics.diagnostics .clear ();
534
534
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
535
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
535
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
536
536
std::cerr << diagnostics.render (input, lm, compiler_options);
537
537
if (!r1.ok ) {
538
538
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -572,6 +572,7 @@ int compile_python_to_object_file(
572
572
auto file_reading_end = std::chrono::high_resolution_clock::now ();
573
573
times.push_back (std::make_pair (" File reading" , std::chrono::duration<double , std::milli>(file_reading_end - file_reading_start).count ()));
574
574
lm.init_simple (input);
575
+ std::cout << " lpython.cpp: " << lm.files [0 ].in_filename << std::endl;
575
576
auto parsing_start = std::chrono::high_resolution_clock::now ();
576
577
LFortran::Result<LFortran::LPython::AST::ast_t *> r = parse_python_file (
577
578
al, runtime_library_dir, infile, diagnostics, compiler_options.new_parser );
@@ -588,11 +589,12 @@ int compile_python_to_object_file(
588
589
diagnostics.diagnostics .clear ();
589
590
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
590
591
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
591
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options,
592
- !(arg_c && compiler_options.disable_main ), infile);
592
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options,
593
+ !(arg_c && compiler_options.disable_main ), infile, input );
593
594
594
595
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
595
596
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
597
+ std::cout << " input: \n " << input << std::endl;
596
598
std::cerr << diagnostics.render (input, lm, compiler_options);
597
599
if (!r1.ok ) {
598
600
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -672,7 +674,7 @@ int compile_to_binary_wasm(
672
674
diagnostics.diagnostics .clear ();
673
675
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
674
676
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
675
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
677
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
676
678
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
677
679
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
678
680
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -737,7 +739,7 @@ int compile_to_binary_x86(
737
739
diagnostics.diagnostics .clear ();
738
740
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
739
741
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
740
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
742
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
741
743
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
742
744
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
743
745
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -802,7 +804,7 @@ int compile_to_binary_wasm_to_x86(
802
804
diagnostics.diagnostics .clear ();
803
805
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
804
806
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
805
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
807
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, lm, diagnostics, compiler_options, true , infile, input );
806
808
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
807
809
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
808
810
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -1067,7 +1069,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_asr_from_source(char *input) {
1067
1069
if (ast.ok ) {
1068
1070
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1069
1071
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1070
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1072
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" , input );
1071
1073
out = diagnostics.render (input, lm, compiler_options);
1072
1074
if (asr.ok ) {
1073
1075
out += LFortran::pickle (*asr.result , compiler_options.use_colors , compiler_options.indent ,
@@ -1085,7 +1087,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wat_from_source(char *input) {
1085
1087
if (ast.ok ) {
1086
1088
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1087
1089
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1088
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1090
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" , input );
1089
1091
out = diagnostics.render (input, lm, compiler_options);
1090
1092
if (asr.ok ) {
1091
1093
LFortran::Result<LFortran::Vec<uint8_t >>
@@ -1112,7 +1114,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_cpp_from_source(char *input) {
1112
1114
if (ast.ok ) {
1113
1115
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1114
1116
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1115
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1117
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" , input );
1116
1118
out = diagnostics.render (input, lm, compiler_options);
1117
1119
if (asr.ok ) {
1118
1120
auto res = LFortran::asr_to_cpp (al, *asr.result , diagnostics,
@@ -1150,7 +1152,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wasm_from_source(char *input) {
1150
1152
if (ast.ok ) {
1151
1153
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1152
1154
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1153
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1155
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" , input );
1154
1156
out = diagnostics.render (input, lm, compiler_options);
1155
1157
if (asr.ok ) {
1156
1158
LFortran::Result<LFortran::Vec<uint8_t >>
0 commit comments