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 selector input check for shared action selectors #358

Merged
merged 2 commits into from
Mar 11, 2017

Conversation

antoninbas
Copy link
Member

No description provided.

} else if (auto mem0 = expr0->to<IR::Member>()) {
auto mem1 = expr1->to<IR::Member>();
return checkSameKeyExpr(mem0->expr, mem1->expr) && mem0->member == mem1->member;
} else if (auto c0 = expr0->to<IR::Constant>()) {
Copy link
Contributor

@mihaibudiu mihaibudiu Mar 10, 2017

Choose a reason for hiding this comment

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

Here you may use to<IR::Literal>; this will handle booleans and enums, in case these are legal in key expressions.
For these cases you can probably use the natural equality operator expr0->operator==(*expr1), since these are leaf expressions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I lied, that won't hande enums, but it will handle booleans.

Copy link
Contributor

Choose a reason for hiding this comment

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

On my TODO list is extending the ir-generator to allow virtual args to methods, so as to make it easy to write a deep-compare function for expressions, or any other thing that needs multiple dynamic dispatch of IR class types.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mbudiu-vmw I implemented the change you suggested

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good.

} else if (auto mem0 = expr0->to<IR::Member>()) {
auto mem1 = expr1->to<IR::Member>();
return checkSameKeyExpr(mem0->expr, mem1->expr) && mem0->member == mem1->member;
} else if (auto c0 = expr0->to<IR::Constant>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

On my TODO list is extending the ir-generator to allow virtual args to methods, so as to make it easy to write a deep-compare function for expressions, or any other thing that needs multiple dynamic dispatch of IR class types.

@ChrisDodd ChrisDodd merged commit 75a969a into master Mar 11, 2017
@antoninbas antoninbas deleted the action-selector-sharing branch April 20, 2017 21:01
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.

3 participants