-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefer if expressions #132
base: master
Are you sure you want to change the base?
Conversation
end Optional_Index_Of; | ||
|
||
function Others_Allowed_For | ||
(Attribute : Attribute_Node_Id) return Boolean | ||
is | ||
begin | ||
if Attribute = Empty_Attribute then | ||
return False; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example where if expression is even simplified away!
|
||
else | ||
if Match (S_Name, I_Regexp) then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another example where if expression is simplified even further
@@ -2341,11 +2328,7 @@ package body Scanner is | |||
|
|||
begin | |||
if Chr = CR then | |||
if Source (P + 1) = LF then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example where the condition is really limited to what it effects: only 2 or 1!
After this pull request, you might want to change some functions into expression functions to make the code even more readable! |
Dear Gprbuild developers,
Since Ada2012 the if expression is supported.
Using the if expression in many cases improves the readability of the code.
Greetings,
Pierre
P.S. When you see no if expression in the change, the code is simplified even further to improve readability.
Problem detected and solved by Rejuvenation-Ada crate