@@ -30,11 +30,30 @@ pointer_typet require_type::require_pointer(
30
30
return pointer;
31
31
}
32
32
33
+ // / Checks that a class has a component with a specific name
34
+ // / \param java_class_type: The class that should have the component
35
+ // / \param component_name: The name of the component
36
+ // / \return The component with the specified name
37
+ java_class_typet::componentt require_type::require_component (
38
+ const java_class_typet &java_class_type,
39
+ const irep_idt &component_name)
40
+ {
41
+ const auto &component = std::find_if (
42
+ java_class_type.components ().begin (),
43
+ java_class_type.components ().end (),
44
+ [&component_name](const java_class_typet::componentt &component) {
45
+ return component.get_name () == component_name;
46
+ });
47
+
48
+ REQUIRE (component != java_class_type.components ().end ());
49
+ return *component;
50
+ }
51
+
33
52
// / Checks a struct like type has a component with a specific name
34
53
// / \param struct_type: The structure that should have the component
35
54
// / \param component_name: The name of the component
36
55
// / \return The component with the specified name
37
- struct_union_typet ::componentt require_type::require_component (
56
+ struct_typet ::componentt require_type::require_component (
38
57
const struct_typet &struct_type,
39
58
const irep_idt &component_name)
40
59
{
0 commit comments