less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.01k stars 3.41k forks source link

Nested @supports throws when getting debug info #3073

Open balpha opened 7 years ago

balpha commented 7 years ago

Using 2.7.2 in Chrome:

>>> less.render(".foo { @supports (bar: baz) { margin: 0; } }", {dumpLineNumbers: "all"})
TypeError: Cannot read property 'lineNumber' of undefined at Function.debugInfo.asComment

This happens because the ruleset parsed here doesn't get a .debugInfo attached to it, and this if block gets executed because the ruleset of a nested @supports isn't .root.

(I'm not familiar enough with the code to know what the right fix is here, hence not a PR).

seven-phases-max commented 7 years ago

Adding bug label, though this option is actually deprecated (thus the coresponding code is about to be removed rather than fixed).