@@ -231,7 +231,7 @@ int emit_asr(const std::string &infile,
231
231
diagnostics.diagnostics .clear ();
232
232
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
233
233
r = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics,
234
- compiler_options, true , " " , infile);
234
+ compiler_options, true , " __main__ " , infile);
235
235
std::cerr << diagnostics.render (lm, compiler_options);
236
236
if (!r.ok ) {
237
237
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -291,7 +291,7 @@ int emit_cpp(const std::string &infile,
291
291
292
292
diagnostics.diagnostics .clear ();
293
293
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
294
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
294
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
295
295
std::cerr << diagnostics.render (lm, compiler_options);
296
296
if (!r1.ok ) {
297
297
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -336,7 +336,7 @@ int emit_c(const std::string &infile,
336
336
337
337
diagnostics.diagnostics .clear ();
338
338
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
339
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
339
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
340
340
std::cerr << diagnostics.render (lm, compiler_options);
341
341
if (!r1.ok ) {
342
342
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -393,7 +393,7 @@ int emit_c_to_file(const std::string &infile, const std::string &outfile,
393
393
394
394
diagnostics.diagnostics .clear ();
395
395
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
396
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
396
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
397
397
std::cerr << diagnostics.render (lm, compiler_options);
398
398
if (!r1.ok ) {
399
399
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -453,7 +453,7 @@ int emit_wat(const std::string &infile,
453
453
454
454
diagnostics.diagnostics .clear ();
455
455
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
456
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
456
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
457
457
std::cerr << diagnostics.render (lm, compiler_options);
458
458
if (!r1.ok ) {
459
459
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -502,7 +502,7 @@ int get_symbols (const std::string &infile,
502
502
if (r1.ok ) {
503
503
LCompilers::LPython::AST::ast_t * ast = r1.result ;
504
504
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
505
- x = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
505
+ x = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
506
506
if (!x.ok ) {
507
507
std::cout << " {}\n " ;
508
508
return 0 ;
@@ -603,7 +603,7 @@ int get_errors (const std::string &infile,
603
603
if (r1.ok ) {
604
604
LCompilers::LPython::AST::ast_t * ast = r1.result ;
605
605
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
606
- r = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
606
+ r = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
607
607
}
608
608
std::vector<LCompilers::error_highlight> diag_lists;
609
609
LCompilers::error_highlight h;
@@ -723,7 +723,7 @@ int emit_llvm(const std::string &infile,
723
723
LCompilers::LPython::AST::ast_t * ast = r.result ;
724
724
diagnostics.diagnostics .clear ();
725
725
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
726
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
726
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
727
727
std::cerr << diagnostics.render (lm, compiler_options);
728
728
if (!r1.ok ) {
729
729
LCOMPILERS_ASSERT (diagnostics.has_error ())
@@ -799,7 +799,7 @@ int compile_python_to_object_file(
799
799
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
800
800
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
801
801
r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options,
802
- !(arg_c && compiler_options.disable_main ), " " , infile);
802
+ !(arg_c && compiler_options.disable_main ), " __main__ " , infile);
803
803
804
804
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
805
805
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
@@ -916,7 +916,7 @@ int compile_to_binary_wasm(
916
916
diagnostics.diagnostics .clear ();
917
917
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
918
918
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
919
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
919
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
920
920
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
921
921
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
922
922
std::cerr << diagnostics.render (lm, compiler_options);
@@ -989,7 +989,7 @@ int compile_to_binary_x86(
989
989
diagnostics.diagnostics .clear ();
990
990
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
991
991
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
992
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
992
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
993
993
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
994
994
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
995
995
std::cerr << diagnostics.render (lm, compiler_options);
@@ -1063,7 +1063,7 @@ int compile_to_binary_wasm_to_x86(
1063
1063
diagnostics.diagnostics .clear ();
1064
1064
auto ast_to_asr_start = std::chrono::high_resolution_clock::now ();
1065
1065
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
1066
- r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " " , infile);
1066
+ r1 = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *ast, diagnostics, compiler_options, true , " __main__ " , infile);
1067
1067
auto ast_to_asr_end = std::chrono::high_resolution_clock::now ();
1068
1068
times.push_back (std::make_pair (" AST to ASR" , std::chrono::duration<double , std::milli>(ast_to_asr_end - ast_to_asr_start).count ()));
1069
1069
std::cerr << diagnostics.render (lm, compiler_options);
@@ -1359,7 +1359,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_asr_from_source(char *input) {
1359
1359
if (ast.ok ) {
1360
1360
auto casted_ast = (LCompilers::LPython::AST::ast_t *)ast.result ;
1361
1361
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
1362
- asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " " , " input" );
1362
+ asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " __main__ " , " input" );
1363
1363
out = diagnostics.render (lm, compiler_options);
1364
1364
if (asr.ok ) {
1365
1365
out += LCompilers::LPython::pickle (*asr.result , compiler_options.use_colors , compiler_options.indent ,
@@ -1377,7 +1377,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wat_from_source(char *input) {
1377
1377
if (ast.ok ) {
1378
1378
auto casted_ast = (LCompilers::LPython::AST::ast_t *)ast.result ;
1379
1379
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
1380
- asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " " , " input" );
1380
+ asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " __main__ " , " input" );
1381
1381
out = diagnostics.render (lm, compiler_options);
1382
1382
if (asr.ok ) {
1383
1383
LCompilers::Result<LCompilers::Vec<uint8_t >>
@@ -1404,7 +1404,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_cpp_from_source(char *input) {
1404
1404
if (ast.ok ) {
1405
1405
auto casted_ast = (LCompilers::LPython::AST::ast_t *)ast.result ;
1406
1406
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
1407
- asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " " , " input" );
1407
+ asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " __main__ " , " input" );
1408
1408
out = diagnostics.render (lm, compiler_options);
1409
1409
if (asr.ok ) {
1410
1410
auto res = LCompilers::asr_to_cpp (al, *asr.result , diagnostics,
@@ -1442,7 +1442,7 @@ EMSCRIPTEN_KEEPALIVE char* emit_wasm_from_source(char *input) {
1442
1442
if (ast.ok ) {
1443
1443
auto casted_ast = (LCompilers::LPython::AST::ast_t *)ast.result ;
1444
1444
LCompilers::Result<LCompilers::ASR::TranslationUnit_t*>
1445
- asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " " , " input" );
1445
+ asr = LCompilers::LPython::python_ast_to_asr (al, lm, nullptr , *casted_ast, diagnostics, compiler_options, true , " __main__ " , " input" );
1446
1446
out = diagnostics.render (lm, compiler_options);
1447
1447
if (asr.ok ) {
1448
1448
LCompilers::Result<LCompilers::Vec<uint8_t >>
0 commit comments