Skip to content

Commit

Permalink
Remove unnecessary function std::string get_type()
Browse files Browse the repository at this point in the history
  • Loading branch information
kmr-srbh committed May 9, 2024
1 parent abc1652 commit ad404f9
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions src/libasr/codegen/asr_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,44 +129,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor<ASRToLpythonVisitor>
}
}

std::string get_type(const ASR::ttype_t *t) {
std::string r = "";
switch (t->type) {
case ASR::ttypeType::Integer : {
r += "i";
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
break;
} case ASR::ttypeType::Real : {
r += "f";
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
break;
} case ASR::ttypeType::Complex : {
r += "c";
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
break;
} case ASR::ttypeType::Character : {
r = "str";
break;
} case ASR::ttypeType::Logical : {
r = "bool";
break;
} case ASR::ttypeType::List : {
r = ASRUtils::type_to_str_python(t);
break;
} case ASR::ttypeType::Tuple : {
r = ASRUtils::type_to_str_python(t);
break;
}case ASR::ttypeType::Set : {
r = ASRUtils::type_to_str_python(t);
break;
} default : {
throw LCompilersException("The type `"
+ ASRUtils::type_to_str_python(t) + "` is not handled yet");
}
}
return r;
}

void visit_TranslationUnit(const ASR::TranslationUnit_t &x) {
std::string r = "";

Expand Down Expand Up @@ -254,7 +216,7 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor<ASRToLpythonVisitor>
std::string r = indent;
r += x.m_name;
r += ": ";
r += get_type(x.m_type);
r += ASRUtils::type_to_str_python(x.m_type);
r += "\n";
s = r;
}
Expand Down

0 comments on commit ad404f9

Please sign in to comment.