@@ -164,9 +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, true ,
168
- compiler_options.disable_main , compiler_options.symtab_only , infile,
169
- compiler_options.import_path );
167
+ r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
170
168
std::cerr << diagnostics.render (input, lm, compiler_options);
171
169
if (!r.ok ) {
172
170
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -208,9 +206,7 @@ int emit_cpp(const std::string &infile,
208
206
209
207
diagnostics.diagnostics .clear ();
210
208
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
211
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
212
- compiler_options.disable_main , compiler_options.symtab_only , infile,
213
- compiler_options.import_path );
209
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
214
210
std::cerr << diagnostics.render (input, lm, compiler_options);
215
211
if (!r1.ok ) {
216
212
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -250,9 +246,7 @@ int emit_c(const std::string &infile,
250
246
251
247
diagnostics.diagnostics .clear ();
252
248
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
253
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
254
- compiler_options.disable_main , compiler_options.symtab_only , infile,
255
- compiler_options.import_path );
249
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
256
250
std::cerr << diagnostics.render (input, lm, compiler_options);
257
251
if (!r1.ok ) {
258
252
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -292,9 +286,7 @@ int emit_wat(const std::string &infile,
292
286
293
287
diagnostics.diagnostics .clear ();
294
288
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
295
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
296
- compiler_options.disable_main , compiler_options.symtab_only , infile,
297
- compiler_options.import_path );
289
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
298
290
std::cerr << diagnostics.render (input, lm, compiler_options);
299
291
if (!r1.ok ) {
300
292
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -337,9 +329,7 @@ int get_symbols (const std::string &infile,
337
329
if (r1.ok ) {
338
330
LFortran::LPython::AST::ast_t * ast = r1.result ;
339
331
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
340
- x = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
341
- compiler_options.disable_main , compiler_options.symtab_only ,
342
- infile, compiler_options.import_path );
332
+ x = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
343
333
if (!x.ok ) {
344
334
std::cout << " {}\n " ;
345
335
return 0 ;
@@ -431,9 +421,7 @@ int get_errors (const std::string &infile,
431
421
if (r1.ok ) {
432
422
LFortran::LPython::AST::ast_t * ast = r1.result ;
433
423
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
434
- r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
435
- compiler_options.disable_main , compiler_options.symtab_only ,
436
- infile, compiler_options.import_path );
424
+ r = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
437
425
}
438
426
std::vector<LFortran::LPython::error_highlight> diag_lists;
439
427
LFortran::LPython::error_highlight h;
@@ -544,9 +532,7 @@ int emit_llvm(const std::string &infile,
544
532
LFortran::LPython::AST::ast_t * ast = r.result ;
545
533
diagnostics.diagnostics .clear ();
546
534
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
547
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
548
- compiler_options.disable_main , compiler_options.symtab_only , infile,
549
- compiler_options.import_path );
535
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
550
536
std::cerr << diagnostics.render (input, lm, compiler_options);
551
537
if (!r1.ok ) {
552
538
LFORTRAN_ASSERT (diagnostics.has_error ())
@@ -602,10 +588,9 @@ int compile_python_to_object_file(
602
588
diagnostics.diagnostics .clear ();
603
589
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
604
590
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
605
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics,
606
- !(arg_c && compiler_options.disable_main ),
607
- compiler_options.disable_main , compiler_options.symtab_only , infile,
608
- compiler_options.import_path );
591
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options,
592
+ !(arg_c && compiler_options.disable_main ), infile);
593
+
609
594
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
610
595
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
611
596
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -687,9 +672,7 @@ int compile_to_binary_wasm(
687
672
diagnostics.diagnostics .clear ();
688
673
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
689
674
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
690
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
691
- compiler_options.disable_main , compiler_options.symtab_only , infile,
692
- compiler_options.import_path );
675
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
693
676
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
694
677
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
695
678
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -754,8 +737,7 @@ int compile_to_binary_x86(
754
737
diagnostics.diagnostics .clear ();
755
738
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
756
739
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
757
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
758
- compiler_options.disable_main , compiler_options.symtab_only , infile, compiler_options.import_path );
740
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
759
741
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
760
742
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
761
743
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -820,8 +802,7 @@ int compile_to_binary_wasm_to_x86(
820
802
diagnostics.diagnostics .clear ();
821
803
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
822
804
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
823
- r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, true ,
824
- compiler_options.disable_main , compiler_options.symtab_only , infile, compiler_options.import_path );
805
+ r1 = LFortran::LPython::python_ast_to_asr (al, *ast, diagnostics, compiler_options, true , infile);
825
806
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
826
807
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
827
808
std::cerr << diagnostics.render (input, lm, compiler_options);
@@ -1086,9 +1067,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_asr_from_source(char *input) {
1086
1067
if (ast.ok ) {
1087
1068
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1088
1069
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1089
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
1090
- compiler_options.disable_main , compiler_options.symtab_only , " input" ,
1091
- compiler_options.import_path );
1070
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1092
1071
out = diagnostics.render (input, lm, compiler_options);
1093
1072
if (asr.ok ) {
1094
1073
out += LFortran::pickle (*asr.result , compiler_options.use_colors , compiler_options.indent ,
@@ -1106,9 +1085,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wat_from_source(char *input) {
1106
1085
if (ast.ok ) {
1107
1086
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1108
1087
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1109
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
1110
- compiler_options.disable_main , compiler_options.symtab_only , " input" ,
1111
- compiler_options.import_path );
1088
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1112
1089
out = diagnostics.render (input, lm, compiler_options);
1113
1090
if (asr.ok ) {
1114
1091
LFortran::Result<LFortran::Vec<uint8_t >>
@@ -1135,9 +1112,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_cpp_from_source(char *input) {
1135
1112
if (ast.ok ) {
1136
1113
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1137
1114
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1138
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
1139
- compiler_options.disable_main , compiler_options.symtab_only , " input" ,
1140
- compiler_options.import_path );
1115
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1141
1116
out = diagnostics.render (input, lm, compiler_options);
1142
1117
if (asr.ok ) {
1143
1118
auto res = LFortran::asr_to_cpp (al, *asr.result , diagnostics,
@@ -1175,9 +1150,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wasm_from_source(char *input) {
1175
1150
if (ast.ok ) {
1176
1151
auto casted_ast = (LFortran::LPython::AST::ast_t *)ast.result ;
1177
1152
LFortran::Result<LFortran::ASR::TranslationUnit_t*>
1178
- asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, true ,
1179
- compiler_options.disable_main , compiler_options.symtab_only , " input" ,
1180
- compiler_options.import_path );
1153
+ asr = LFortran::LPython::python_ast_to_asr (al, *casted_ast, diagnostics, compiler_options, true , " input" );
1181
1154
out = diagnostics.render (input, lm, compiler_options);
1182
1155
if (asr.ok ) {
1183
1156
LFortran::Result<LFortran::Vec<uint8_t >>
0 commit comments