@@ -153,15 +153,35 @@ static inline std::string unop_to_str(const ASR::unaryopType t) {
153153 }
154154}
155155
156+ static inline std::string binop_to_str (const ASR ::binopType t) {
157+ switch (t) {
158+ case (ASR ::binopType::Add): { return " + " ; }
159+ case (ASR ::binopType::Sub): { return " - " ; }
160+ case (ASR ::binopType::Mul): { return " *" ; }
161+ case (ASR ::binopType::Div): { return " /" ; }
162+ default : throw LFortranException (" Cannot represent the binary operator as a string" );
163+ }
164+ }
165+
156166static inline std::string cmpop_to_str (const ASR ::cmpopType t) {
157167 switch (t) {
158- case (ASR ::cmpopType::Eq): { return " ==" ; }
159- case (ASR ::cmpopType::NotEq): { return " !=" ; }
160- case (ASR ::cmpopType::Lt): { return " <" ; }
161- case (ASR ::cmpopType::LtE): { return " <=" ; }
162- case (ASR ::cmpopType::Gt): { return " >" ; }
163- case (ASR ::cmpopType::GtE): { return " >=" ; }
164- default : throw LFortranException (" Not implemented" );
168+ case (ASR ::cmpopType::Eq): { return " == " ; }
169+ case (ASR ::cmpopType::NotEq): { return " != " ; }
170+ case (ASR ::cmpopType::Lt): { return " < " ; }
171+ case (ASR ::cmpopType::LtE): { return " <= " ; }
172+ case (ASR ::cmpopType::Gt): { return " > " ; }
173+ case (ASR ::cmpopType::GtE): { return " >= " ; }
174+ default : throw LFortranException (" Cannot represent the comparison as a string" );
175+ }
176+ }
177+
178+ static inline std::string boolop_to_str (const ASR ::boolopType t) {
179+ switch (t) {
180+ case (ASR ::boolopType::And): { return " && " ; }
181+ case (ASR ::boolopType::Or): { return " || " ; }
182+ case (ASR ::boolopType::Eqv): { return " == " ; }
183+ case (ASR ::boolopType::NEqv): { return " != " ; }
184+ default : throw LFortranException (" Cannot represent the boolean operator as a string" );
165185 }
166186}
167187
@@ -348,6 +368,18 @@ static inline bool is_intrinsic_function(const ASR::Function_t *fn) {
348368 return false ;
349369}
350370
371+ // Returns true if the Function is intrinsic, otherwise false
372+ // This version uses the `intrinsic` member of `Module`, so it
373+ // should be used instead of is_intrinsic_function
374+ static inline bool is_intrinsic_function2 (const ASR ::Function_t *fn) {
375+ ASR ::symbol_t *sym = (ASR ::symbol_t *)fn;
376+ ASR ::Module_t *m = get_sym_module0 (sym);
377+ if (m != nullptr ) {
378+ if (m->m_intrinsic ) return true ;
379+ }
380+ return false ;
381+ }
382+
351383// Returns true if all arguments have a `value`
352384static inline bool all_args_have_value (const Vec<ASR ::expr_t *> &args) {
353385 for (auto &a : args) {
0 commit comments