sander / code-illuminated

Automatically exported from code.google.com/p/code-illuminated
0 stars 0 forks source link

Automatically recognize method definitions (and other code structure) #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In a gnome-shell bug about CI, Owen Taylor writes:
> Having to add wiki-markup to mark each class and function is a bit
> cumbersome. Having undocumented functions not show up at all could be
> confusing. The code describes itself what the functions are, what the
> classes are, it would be nice if the tool could pick that up. 
http://bugzilla.gnome.org/show_bug.cgi?id=574573#c1

Because JavaScript allows for multiple ways of defining functions, and you 
might not want to document inline functions or private methods, it seems 
hard to find a one-size-fits-all solution. So I think we at least need to 
allow for some manual per-project configuaration.

There are some things CI could do automatically. For example, the following 
ways of defining a method seem to be often used:

    MyObject.prototype.myMethod = function myMethod(arg) { ... };
    MyObject.prototype = { myMethod: function(arg) { ... } };

CI should recognize both constructions and add a "MyObject.myMethod(arg)" 
header. (I think the arguments should be included, but this may be 
debatable.) If such a header is already in the Creole comment, it should 
not be automatically duplicated of course.

I think the main point of this would be to avoid confusion about why a new 
method isn't added to the docs yet, and to keep the CI pages structured 
even when the documentation isn't finished yet.

Original issue reported on code.google.com by sander.d...@gmail.com on 6 Jun 2009 at 12:40