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
[Suggestion] @ModifyComparisonArg
#21
Comments
Question: would it be beneficial to do something similar for logical operations (AND, OR)? or does |
I haven't put much thought into the name yet, so here's some alternative names: @WrapComparisonArg, @ModifyComparisonExpression, @WrapComparisonExpression. |
The trouble is that targeting such operations is inherently brittle because the instructions are so generic. Slices make it a bit better but it's still not ideal. I may implement something along these lines in the future but it's not a priority because the situations are fairly esoteric (I've yet to encounter anything like you've described in the wild). If there's any specific scenarios you'd like this for, feel free to ask about them. |
I do have a plan for this now. |
This would wrap the entire left-hand or right-hand side of a comparison, which could be chained by multiple mixins.
Example:
Code diff:
Note: in this example code diff, there is no way to add 5 to either side. If you used a
@ModifyExpressionValue
on foo.get(), then any value you add gets multiplied by 4 (which will not be the same result). And if you used a@ModifyConstant
or@Redirect
on the field access, then (in this example) any change you make will also get multiplied by the other values in the expression (again, not the same result), while also not being compatible with any other mixins using the same target.The text was updated successfully, but these errors were encountered: