Skip to content

Commit

Permalink
Properly exit calc mode after use (#3493)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean committed May 5, 2020
1 parent 49ccd10 commit a1862fe
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/less/contexts.js
Expand Up @@ -74,7 +74,7 @@ contexts.Eval.prototype.enterCalc = function () {

contexts.Eval.prototype.exitCalc = function () {
this.calcStack.pop();
if (!this.calcStack) {
if (!this.calcStack.length) {
this.inCalc = false;
}
};
Expand Down
9 changes: 9 additions & 0 deletions test/css/calc.css
Expand Up @@ -17,3 +17,12 @@
.c {
height: calc(100% - ((10px * 3) + (10px * 2)));
}
.correctly-exit-calc-mode h2 {
width: 10px;
}
.correctly-exit-calc-mode div {
width: calc(100px * 2);
}
.correctly-exit-calc-mode h1 {
color: white;
}
18 changes: 17 additions & 1 deletion test/less/calc.less
Expand Up @@ -27,4 +27,20 @@
.c {
@v: 10px;
height: calc(100% - ((@v * 3) + (@v * 2)));
}
}

.correctly-exit-calc-mode {
@a: 10;
h2 { width: unit(@a, px); }

div { width: calc(100px * 2); }

.mk-map() {
text: white;
background: black;
}

@p: .mk-map();

h1 { color: @p[text]; }
}
2 changes: 1 addition & 1 deletion test/sourcemaps/custom-props.json
@@ -1 +1 @@
{"version":3,"sources":["testweb/sourcemaps/custom-props.less"],"names":[],"mappings":"AAEA;EACC,uBAHO,UAGP;EACA,OAAO,eAAP;EACA,gCAAA","file":"sourcemaps/custom-props.css"}
{"version":3,"sources":["testweb/sourcemaps/custom-props.less"],"names":[],"mappings":"AAEA;EACC,uBAHO,UAGP;EACA,OAAO,eAAP;EACA,sBALO,UAKP","file":"sourcemaps/custom-props.css"}

0 comments on commit a1862fe

Please sign in to comment.