csnover / js-doc-parse

An experimental library for parsing JavaScript files and extracting inline documentation.
31 stars 7 forks source link

lang.extend({}, stuff) puts stuff in Object.prototype, thus appearing everywhere #45

Open wkeese opened 12 years ago

wkeese commented 12 years ago

When running parse.sh on the dojo/ directory (dojo core code), it gets confused about which methods belong to which objects. For example, AdapterRegistry is listed as having the animation functions:

<object location="dojo/AdapterRegistry" type="function">
<properties>...</properties>
<methods>
<method name="_anim" scope="prototype" type="function" from="dojo/NodeList-fx">...</method>
<method name="wipeIn" scope="prototype" type="function" from="dojo/NodeList-fx">
<parameters>
wkeese commented 12 years ago

OK, I managed to work around the problem by cleaning up the usage of NodeList, see http://bugs.dojotoolkit.org/changeset/28941/dojo.

It was partially caused by the module-level-summary workarounds where files like NodeList-fx.js have

/*=====
return {
   // summary:
   //      ...
};
=====*/

...

return NodeList;

So, not sure if there's a bug here or not, you can just close it if you like.

csnover commented 12 years ago

The way that prototypes are set for non-Function values is a bit wrong right now, which means that if someone does lang.extend({}, stuff) the keys from stuff will get set on Object.prototype even though {} does not have a prototype (only __proto__).

wkeese commented 12 years ago

Ha ha, OK yes that explains the bizarre behavior. Anyway this isn't blocking the release, you can set it to milestone future.