Refactors task checking in Ada anonymous access returns
Refactors `Check_Anonymous_Access_Return_With_Tasks` to use a predicate for task checking in Ada.
This commit refactors the Check_Anonymous_Access_Return_With_Tasks procedure in the Ada compiler. Instead of using a custom implementation to check for tasks, it now calls the Might_Have_Tasks predicate. This change promotes code reuse and consistency within the compiler.
In Details
The commit modifies sem_ch6.adb, specifically the Check_Anonymous_Access_Return_With_Tasks procedure. The procedure's custom task check is replaced with a call to the Might_Have_Tasks predicate. This enhances code maintainability by leveraging existing functionality.
For Context
This commit improves the internal structure of the Ada compiler. It replaces a specific, custom code section with a more general-purpose function. This makes the code easier to maintain and less prone to errors, as changes to task checking logic only need to be made in one place.