diff --git a/lib/processor/dojodoc.js b/lib/processor/dojodoc.js index 5c0ad8a..152b544 100644 --- a/lib/processor/dojodoc.js +++ b/lib/processor/dojodoc.js @@ -145,17 +145,29 @@ define([ 'An object with the following properties:\n'; (function readProperties(object) { - var propertyMetadata; - for (var k in object.properties) { - if (_hasOwnProperty.call(object.properties, k)) { + var propertyMetadata, + properties = object.properties, + k; + + // if the annotationObject is a function, we don't want to pick up any properties apart + // from what's on the prototype. + if (object.type === 'function') { + if (_hasOwnProperty.call(properties, 'prototype')) { + readProperties(properties.prototype); + } + return; + } + + for (k in properties) { + if (_hasOwnProperty.call(properties, k)) { // Type descriptor could be a plain JS object, or could be a constructor. It is often the // latter. if (k === 'prototype') { - readProperties(object.properties[k]); + readProperties(properties[k]); } // Filter out built-ins and constructor properties which come from dojo/_base/declare - else if (k !== 'constructor' && object.properties[k].file) { - propertyMetadata = object.properties[k].metadata; + else if (k !== 'constructor' && properties[k].file) { + propertyMetadata = properties[k].metadata; additionalDescription += stringUtil.substitute(propertyTemplate, { key: k, type: propertyMetadata.type ? ' (' + propertyMetadata.type + (propertyMetadata.isOptional ? ', optional' : '') + ')' : '',