Skip to content

Commit ad404f9

Browse files
committed
Remove unnecessary function std::string get_type()
1 parent abc1652 commit ad404f9

File tree

1 file changed

+1
-39
lines changed

1 file changed

+1
-39
lines changed

src/libasr/codegen/asr_to_python.cpp

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -129,44 +129,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor<ASRToLpythonVisitor>
129129
}
130130
}
131131

132-
std::string get_type(const ASR::ttype_t *t) {
133-
std::string r = "";
134-
switch (t->type) {
135-
case ASR::ttypeType::Integer : {
136-
r += "i";
137-
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
138-
break;
139-
} case ASR::ttypeType::Real : {
140-
r += "f";
141-
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
142-
break;
143-
} case ASR::ttypeType::Complex : {
144-
r += "c";
145-
r += std::to_string(ASRUtils::extract_kind_from_ttype_t(t)*8);
146-
break;
147-
} case ASR::ttypeType::Character : {
148-
r = "str";
149-
break;
150-
} case ASR::ttypeType::Logical : {
151-
r = "bool";
152-
break;
153-
} case ASR::ttypeType::List : {
154-
r = ASRUtils::type_to_str_python(t);
155-
break;
156-
} case ASR::ttypeType::Tuple : {
157-
r = ASRUtils::type_to_str_python(t);
158-
break;
159-
}case ASR::ttypeType::Set : {
160-
r = ASRUtils::type_to_str_python(t);
161-
break;
162-
} default : {
163-
throw LCompilersException("The type `"
164-
+ ASRUtils::type_to_str_python(t) + "` is not handled yet");
165-
}
166-
}
167-
return r;
168-
}
169-
170132
void visit_TranslationUnit(const ASR::TranslationUnit_t &x) {
171133
std::string r = "";
172134

@@ -254,7 +216,7 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor<ASRToLpythonVisitor>
254216
std::string r = indent;
255217
r += x.m_name;
256218
r += ": ";
257-
r += get_type(x.m_type);
219+
r += ASRUtils::type_to_str_python(x.m_type);
258220
r += "\n";
259221
s = r;
260222
}

0 commit comments

Comments
 (0)