11
11
// / Find in the parsed class a specific entry within the
12
12
// / lambda_method_handle_map with a matching descriptor. Will fail if no
13
13
// / matching lambda entry found.
14
- // / \param parsed_class: the class to inspect
15
- // / \param lambda_method_ref: the reference/descriptor of the lambda method
16
- // / to which this lambda entry points to, must be unique
17
- // / \param method_type: the descriptor the lambda method should have
14
+ // / \param parsed_class the class to inspect
15
+ // / \param lambda_method_ref the reference/descriptor of the lambda method
16
+ // / to which this lambda entry points to, must be unique
17
+ // / \param method_type the descriptor the lambda method should have
18
18
// / \return
19
19
require_parse_tree::lambda_method_handlet
20
20
require_parse_tree::require_lambda_entry_for_descriptor (
@@ -29,28 +29,20 @@ require_parse_tree::require_lambda_entry_for_descriptor(
29
29
" Looking for entry with lambda_method_ref: " << lambda_method_ref
30
30
<< " and method_type: "
31
31
<< method_type);
32
- const auto num_matches = std::count_if (
32
+ std::vector<lambda_method_entryt> matches;
33
+ std::copy_if (
33
34
parsed_class.lambda_method_handle_map .begin (),
34
35
parsed_class.lambda_method_handle_map .end (),
35
- [&method_type, &lambda_method_ref](const lambda_method_entryt &entry) {
36
+ back_inserter (matches),
37
+ [&method_type,
38
+ &lambda_method_ref](const lambda_method_entryt &entry) { // NOLINT
36
39
return (
37
40
entry.second .method_type == method_type &&
38
41
entry.second .lambda_method_ref == lambda_method_ref);
39
42
});
40
-
41
- REQUIRE (num_matches == 1 );
42
- INFO (" Entry found" );
43
- const auto matching_lambda_entry = std::find_if (
44
- parsed_class.lambda_method_handle_map .begin (),
45
- parsed_class.lambda_method_handle_map .end (),
46
- [&method_type, &lambda_method_ref](const lambda_method_entryt &entry) {
47
- return (
48
- entry.second .method_type == method_type &&
49
- entry.second .lambda_method_ref == lambda_method_ref);
50
- });
51
- REQUIRE (matching_lambda_entry != parsed_class.lambda_method_handle_map .end ());
52
-
53
- return matching_lambda_entry->second ;
43
+ INFO (" Number of matching lambda method entries: " << matches.size ());
44
+ REQUIRE (matches.size () == 1 );
45
+ return matches.at (0 ).second ;
54
46
}
55
47
56
48
// / Finds a specific method in the parsed class with a matching name.
0 commit comments