@@ -2447,40 +2447,6 @@ class BodyVisitor : public CommonVisitor<BodyVisitor> {
2447
2447
ASRUtils::type_to_str (float_type) + " '" , x.base .base .loc );
2448
2448
}
2449
2449
return ;
2450
- } else if (call_name == " str" ) {
2451
- ASR::ttype_t * str_type = ASRUtils::TYPE (ASR::make_Character_t (al,
2452
- x.base .base .loc , 1 , 1 , nullptr , nullptr , 0 ));
2453
- if (args.size () == 0 ) { // create an empty string
2454
- tmp = ASR::make_ConstantString_t (al, x.base .base .loc , s2c (al, " " ), str_type);
2455
- return ;
2456
- }
2457
- ASR::expr_t * arg = ASRUtils::expr_value (args[0 ]);
2458
- ASR::ttype_t * arg_type = ASRUtils::expr_type (arg);
2459
- if (arg == nullptr ) {
2460
- throw SemanticError (" runtime str(x) is not supported, only compile time for now" ,
2461
- x.base .base .loc );
2462
- }
2463
- if (ASRUtils::is_integer (*arg_type)) {
2464
- int64_t ival = ASR::down_cast<ASR::ConstantInteger_t>(arg)->m_n ;
2465
- std::string s = std::to_string (ival);
2466
- tmp = ASR::make_ConstantString_t (al, x.base .base .loc , s2c (al, s), str_type);
2467
- } else if (ASRUtils::is_real (*arg_type)) {
2468
- double rval = ASR::down_cast<ASR::ConstantReal_t>(arg)->m_r ;
2469
- std::string s = std::to_string (rval);
2470
- tmp = ASR::make_ConstantString_t (al, x.base .base .loc , s2c (al, s), str_type);
2471
- } else if (ASRUtils::is_logical (*arg_type)) {
2472
- bool rv = ASR::down_cast<ASR::ConstantLogical_t>(arg)->m_value ;
2473
- std::string s = rv ? " True" : " False" ;
2474
- tmp = ASR::make_ConstantString_t (al, x.base .base .loc , s2c (al, s), str_type);
2475
- } else if (ASRUtils::is_character (*arg_type)) {
2476
- char * c = ASR::down_cast<ASR::ConstantString_t>(arg)->m_s ;
2477
- std::string s = std::string (c);
2478
- tmp = ASR::make_ConstantString_t (al, x.base .base .loc , s2c (al, s), str_type);
2479
- } else {
2480
- throw SemanticError (" str() argument must be real, integer, logical, or a string, not '" +
2481
- ASRUtils::type_to_str (arg_type) + " '" , x.base .base .loc );
2482
- }
2483
- return ;
2484
2450
} else if (call_name == " divmod" ) {
2485
2451
if (args.size () != 2 ) {
2486
2452
throw SemanticError (call_name + " () takes exactly two arguments (" +
0 commit comments