Emit a warning for && (#207)

See sass/sass#2429
This commit is contained in:
Natalie Weizenbaum 2018-01-03 19:12:53 -08:00 committed by GitHub
parent c49e037e34
commit 75776ca062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,7 @@
## 1.0.0-beta.5
* Emit a warning when `&&` is used, since it's probably not what the user means.
* `round()` now returns the correct results for negative numbers that should
round down.

View File

@ -1947,6 +1947,15 @@ abstract class StylesheetParser extends Parser {
SelectorExpression _selector() {
var start = scanner.state;
scanner.expectChar($ampersand);
if (scanner.scanChar($ampersand)) {
warn('In Sass, "&&" means two copies of the parent selector. You '
'probably want to use "and" instead.',
scanner.spanFrom(start),
color: color);
scanner.position--;
}
return new SelectorExpression(scanner.spanFrom(start));
}