-
Notifications
You must be signed in to change notification settings - Fork 445
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
Conversation
backends/bmv2/jsonconverter.cpp
Outdated
} 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>()) { |
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.
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.
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.
I lied, that won't hande enums, but it will handle booleans.
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.
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.
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.
@mbudiu-vmw I implemented the change you suggested
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.
Looks good.
backends/bmv2/jsonconverter.cpp
Outdated
} 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>()) { |
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.
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.
2709f9d
to
f3ca186
Compare
f3ca186
to
9e8547e
Compare
No description provided.