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

Add prefixes and parentheses to calc function #988

Merged
merged 14 commits into from
Nov 24, 2024

Conversation

RobertasJ
Copy link
Contributor

Added support for:

  • parenthesses syntax
  • implicit multiplication:
    • calc(1.5(5 + 7)
  • prefixes:
    • calc(-(5 - 10))

@RobertasJ RobertasJ requested a review from marc2332 as a code owner October 20, 2024 08:44
Copy link

codecov bot commented Oct 20, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 4 lines in your changes missing coverage. Please review.

Project coverage is 74.26%. Comparing base (00ca902) to head (9363996).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
crates/torin/src/values/size.rs 90.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #988      +/-   ##
==========================================
- Coverage   74.34%   74.26%   -0.09%     
==========================================
  Files         214      215       +1     
  Lines       24739    24644      -95     
==========================================
- Hits        18393    18301      -92     
+ Misses       6346     6343       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@marc2332 marc2332 added the enhancement 🔥 New feature or request label Oct 24, 2024
@marc2332 marc2332 added this to the 0.3.0 milestone Oct 24, 2024
crates/torin/src/values/size.rs Outdated Show resolved Hide resolved
crates/torin/tests/size.rs Outdated Show resolved Hide resolved
@marc2332 marc2332 self-requested a review November 10, 2024 11:34
match prefix {
DynamicCalculation::Add => lhs,
DynamicCalculation::Sub => lhs.map(|v| v * -1.0),
_ => unreachable!("make sure to add the prefix here"),
Copy link
Owner

Choose a reason for hiding this comment

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

Not sure what you mean by this message, can this actually happen? if this can happen we should not be panicking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it cannot happen, if this happens it means the person adding a new prefix would have forgotten to handle it here

crates/torin/src/values/size.rs Outdated Show resolved Hide resolved
Copy link
Owner

@marc2332 marc2332 left a comment

Choose a reason for hiding this comment

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

for a second I thought I was going crazy but I think you forgot to handle parsing right? parse_calc

@marc2332 marc2332 self-requested a review November 24, 2024 10:52
@marc2332 marc2332 merged commit 4a23fb7 into marc2332:main Nov 24, 2024
1 of 4 checks passed
@RobertasJ RobertasJ deleted the feat/parenthesis branch November 24, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🔥 New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants