Skip to content

Conversation

matthew-dean
Copy link
Member

@matthew-dean matthew-dean commented Jun 27, 2018

Fixes #3235 - Vars storing calculations don't crunch the calculation if the var is used in calc.

The solution here is a bit of a hack, but it shouldn't affect performance. Basically, if we're "inside" a calc() (in the evaluation stage), it wraps any vars during evaluation as a function call. This switches the math back on in the Call Node, and evaluates all the arguments to the call node before merging the value into calc().

Copy link
Member

@calvinjuarez calvinjuarez left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix on this one!

@@ -1,4 +1,9 @@
@val: 10px;
.no-math {
@c: 10px + 20px;
Copy link
Member

Choose a reason for hiding this comment

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

Is this with --strict-math=on?

Copy link
Member

Choose a reason for hiding this comment

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

N/m just tested and seeing it work as intended.

@matthew-dean matthew-dean merged commit f1a3a25 into less:master Jun 30, 2018
@matthew-dean
Copy link
Member Author

@calvinjuarez Thanks for reviewing!

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