Skip to content

Commit

Permalink
Produce a better error message for unclosed style rules (#586)
Browse files Browse the repository at this point in the history
Closes #577
  • Loading branch information
nex3 authored Feb 2, 2019
1 parent b102dc4 commit a810172
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
next token that wasn't what was expected, they point *after* the previous
token. This should generally provide more context for the syntax error.

* Produce a better error message for style rules that are missing the closing
`}`.

### Command-Line Interface

* Passing a directory on the command line now compiles all Sass source files in
Expand Down
2 changes: 2 additions & 0 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ abstract class StylesheetParser extends Parser {
var wasInStyleRule = _inStyleRule;
_inStyleRule = true;

if (buffer.isEmpty) scanner.error('expected "}".');

return _withChildren(_statement, start, (children, span) {
if (indented && children.isEmpty) {
warn("This selector doesn't have any properties and won't be rendered.",
Expand Down

0 comments on commit a810172

Please sign in to comment.