Skip to content

Commit

Permalink
fixed empty objects with single comment
Browse files Browse the repository at this point in the history
  • Loading branch information
weepy committed Jul 5, 2011
1 parent ed729a8 commit c920d93
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions expectations/block_scope
@@ -1,4 +1,15 @@
#block_scope

compiles:
x = {
// comment
}

to:
x = {
// comment
}

compiles:
{leave: objects}
{}
Expand Down Expand Up @@ -31,3 +42,7 @@ compiles:
to:
(function() {;}).call(this)





2 changes: 2 additions & 0 deletions lib/plugins/block_scope.js
Expand Up @@ -5,7 +5,9 @@ module.exports = function(stream) {
Token.current_token = this

if(token.blockType != "object") return

if(token.next == token.matching) return // empty object
if(token.nextNW() == token.matching) return // added to allow for empty objects with comments
if(token.nextNW().next.text == ":") return // must be an object

var pair = Token.bracket.pair("()")
Expand Down

0 comments on commit c920d93

Please sign in to comment.