Skip to content
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

fix: Incorrect operator precedence in conditional assembly expressions #13

Conversation

slavek-kucera
Copy link

@slavek-kucera slavek-kucera commented Apr 29, 2022

@slavek-kucera slavek-kucera requested review from jirimosinger and removed request for jirimosinger April 29, 2022 17:36
Comment on lines +304 to +310
auto o = get_operator(symbol);
if (o == ca_expr_ops::UNKNOWN)
return std::monostate();
bool unary = is_unary(o);
bool binary = is_binary(o);
if (!unary && !binary)
return invalid_by_policy();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to create a static function in ca_common_expr_policy that will do this set of checks as this part is duplicated 3 times?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the is_unary and is_binary are specialized by the individual policies, so I cannot really do it that way, but I am considering just droping all those functions in favor of one switch(-like) code...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see. Other option could be having a base class (e.g. ca_arithmetic_policy_base) from which the other policies could be derived.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 2, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

94.9% 94.9% Coverage
3.5% 3.5% Duplication

@slavek-kucera slavek-kucera merged commit c90138b into BroadcomMFD-DevOps:development May 2, 2022
@slavek-kucera slavek-kucera deleted the fix_ca_op_precedence branch May 2, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants