File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -604,6 +604,19 @@ class java_generic_symbol_typet : public symbol_typet
604
604
{
605
605
return (generic_typest &)(add (ID_generic_types).get_sub ());
606
606
}
607
+
608
+ // / Check if this symbol has the given generic type. If yes, return its index
609
+ // / in the vector of generic types.
610
+ // / \param type The type we are looking for.
611
+ // / \return The index of the type in the vector of generic types.
612
+ optionalt<size_t > generic_type_index (const reference_typet &type) const
613
+ {
614
+ const auto &type_pointer =
615
+ std::find (generic_types ().begin (), generic_types ().end (), type);
616
+ if (type_pointer != generic_types ().end ())
617
+ return type_pointer - generic_types ().begin ();
618
+ return {};
619
+ }
607
620
};
608
621
609
622
// / \param type: the type to check
Original file line number Diff line number Diff line change @@ -407,6 +407,19 @@ class class_typet:public struct_typet
407
407
return false ;
408
408
}
409
409
410
+ // / Return the base with the given name, if exists.
411
+ // / \param id The name of the base we are looking for.
412
+ // / \return The base if exists.
413
+ optionalt<baset> get_base (const irep_idt &id) const
414
+ {
415
+ for (const auto &b : bases ())
416
+ {
417
+ if (to_symbol_type (b.type ()).get_identifier () == id)
418
+ return b;
419
+ }
420
+ return {};
421
+ }
422
+
410
423
bool is_abstract () const
411
424
{
412
425
return get_bool (ID_abstract);
You can’t perform that action at this time.
0 commit comments