Permalink
Browse files

Fix for static methods using '@method: ->' syntax

  • Loading branch information...
1 parent 0dba579 commit 73b8b84c0f7f000b01e848419b50e250366156be Omar Khan committed Oct 31, 2011
Showing with 9 additions and 2 deletions.
  1. +6 −2 src/coffeedoc.coffee
  2. +3 −0 test/test.coffee
View
@@ -72,10 +72,14 @@ documentClass = (cls) ->
instancemethods = []
for expr in cls.body.expressions
if expr.type == 'Value'
- # Instance methods
for method in (n for n in expr.base.objects \
when n.type == 'Assign' and n.value.type == 'Code')
- instancemethods.push(method)
+ if method.variable.this
+ # Method attached to `this`, i.e. the constructor
+ staticmethods.push(method)
+ else
+ # Method attached to prototype
+ instancemethods.push(method)
else if expr.type == 'Assign' and expr.value.type == 'Code'
# Static method
if expr.variable.this # Only include public methods
View
@@ -31,6 +31,9 @@ class Subclass extends MyClass
@static = (args) ->
### This is a static method ###
+ @static2: (args) ->
+ ### This is another static method ###
+
myMethod: (arg) =>
return arg + 1

0 comments on commit 73b8b84

Please sign in to comment.