Permalink
Browse files

Fix for empty classes with docstrings

  • Loading branch information...
1 parent 54f37fe commit 0cf2157c5b585b7e73b917813b3607529c1b4212 Omar Khan committed May 5, 2012
Showing with 5 additions and 8 deletions.
  1. +5 −8 src/coffeedoc.coffee
View
@@ -55,16 +55,13 @@ documentClass = (cls) ->
# Class assigned to variable -- ignore the variable definition
cls = cls.value
- # Check if class is empty
- emptyclass = cls.body.expressions.length == 0
-
# Get docstring
- first_obj = if emptyclass
- cls.body.expressions[0]
+ if cls.body.expressions.length <= 1
+ firstObj = cls.body.expressions[0]
else
- cls.body.expressions[0].base?.objects?[0]
- if first_obj?.type == 'Comment'
- docstring = formatDocstring(first_obj.comment)
+ firstObj = cls.body.expressions[0].base?.objects?[0]
+ if firstObj?.type == 'Comment'
+ docstring = formatDocstring(firstObj.comment)
else
docstring = null

0 comments on commit 0cf2157

Please sign in to comment.