Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed bug in param setter that ignored params defined in doclets. Twe…

…aked template.

git-svn-id: http://jsdoc-toolkit.googlecode.com/svn/branches/version2.0@548 c4b26cf2-672e-0410-81b6-737671b986b9
  • Loading branch information...
commit 2bb88d720c08dbeb285c8b2a6a949725d7a5f67d 1 parent f20d199
micmath authored
2  app/frame/Chain.js
View
@@ -1,8 +1,10 @@
+/**@constructor*/
function ChainNode(object, link) {
this.value = object;
this.link = link; // describes this node's relationship to the previous node
}
+/**@constructor*/
function Chain(valueLinks) {
this.nodes = [];
this.cursor = -1;
1  app/frame/Hash.js
View
@@ -1,3 +1,4 @@
+/**@constructor*/
function Hash() {
this.reset();
}
4 app/frame/Link.js
View
@@ -1,4 +1,6 @@
-/** Handle the creation of HTML links to documented symbols. */
+/** Handle the creation of HTML links to documented symbols.
+ @constructor
+*/
function Link() {
this.alias = "";
this.src = "";
1  app/frame/Reflection.js
View
@@ -1,3 +1,4 @@
+/**@constructor*/
function Reflection(obj) {
this.obj = obj;
}
27 app/lib/JSDOC/DocComment.js
View
@@ -172,5 +172,28 @@ JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) {
return this.tags.filter(function($){return $.title == tagTitle});
}
-/**/
-JSDOC.DocComment.shared = "";
+/*~t
+ assert("testing JSDOC.DocComment#getTag");
+ requires("../frame/String.js");
+ requires("../lib/JSDOC/DocTag.js");
+
+ var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/");
+ assertEqual(com.getTag("bar").length, 2, "getTag returns expected number of tags.");
+*/
+
+/**
+ Used to store the currently shared tag text.
+*/
+JSDOC.DocComment.shared = "";
+
+/*~t
+ assert("testing JSDOC.DocComment.shared");
+ requires("../frame/String.js");
+ requires("../lib/JSDOC/DocTag.js");
+
+ JSDOC.DocComment.shared = "@author Michael";
+
+ var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/");
+ assertEqual(com.getTag("author").length, 1, "getTag returns shared tag.");
+ assertEqual(com.getTag("foo").length, 2, "getTag returns unshared tags too.");
+*/
28 app/lib/JSDOC/Symbol.js
View
@@ -10,7 +10,7 @@ JSDOC.Symbol = function() {
}
JSDOC.Symbol.prototype.init = function() {
- this.$args = {};
+ this.$args = [];
this.addOn = "";
this.alias = "";
this.augments = [];
@@ -83,6 +83,9 @@ JSDOC.Symbol.prototype.__defineSetter__("params",
if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name);
}
+ else {
+ this._params[i] = v[i];
+ }
}
}
);
@@ -254,6 +257,7 @@ JSDOC.Symbol.prototype.setTags = function() {
if (params.length) {
// user-defined params overwrite those with same name defined by the parser
var thisParams = this.params;
+
if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
this.params = params;
}
@@ -272,7 +276,27 @@ JSDOC.Symbol.prototype.setTags = function() {
}
/*~t
- // todo
+ var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/"));
+ assertEqual(sym.params.length, 1, "parser defined param is found.");
+
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/"));
+ assertEqual(sym.params.length, 1, "user defined param is found.");
+ assertEqual(sym.params[0].type, "array", "user defined param type is found.");
+ assertEqual(sym.params[0].name, "pages", "user defined param name is found.");
+
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
+ assertEqual(sym.params.length, 1, "user defined param overwrites parser defined param.");
+ assertEqual(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
+ assertEqual(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
+
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
+ assertEqual(sym.params.length, 2, "user defined params overlay parser defined params.");
+ assertEqual(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
+ assertEqual(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
+
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
+ assertEqual(sym.params.length, 1, "user defined param with description is found.");
+ assertEqual(sym.params[0].desc, "The pages description.", "user defined param description is found.");
*/
// @constructor
14 changes.txt
View
@@ -1,3 +1,4 @@
+ * Upgraded included version of Rhino from 1.6 to 1.7R1.
* Removed circular references in parsed documentation objects.
* Improved inheritance handling, now properties and events can be inherited same as methods.
* Improved handling of cross-file relationships, now having two related objects in separate files is not a problem.
@@ -7,7 +8,7 @@
* Added @default to document default values of members that are objects.
* Added ability to parse and refer to inner functions.
* Fixed bug that appeared when calling a method to set properties of the instance referred to by "this".
- * Added ability to more easily link to other symbol.
+ * Added ability to automatically create links to other symbols.
* New "jsdoc" template now produces fully W3C valid XHTML.
* Inline parameter type hint comments are now documented.
* Fixed error: Locally scoped variables (declared with var) no longer appear as global.
@@ -15,7 +16,14 @@
* Added support for inline {@link ...} tags.
* Added support for the -H command-line option to allow for custom content handlers.
* Tag names @inherits and @scope changed to @borrows and @lends.
- * Combining @constructor in a doclet with @lends now supported.
+ ? Combining @constructor in a doclet with @lends now supported.
* Multiple @lend tags now supported.
* Added support for the @constructs tag, used inside a @lends block.
- * Added support for the @constant tag.
+ * Added support for the @constant tag.
+ * Fixed bug that prevented the use of [] as a default value.
+ * Added support for the @field tag.
+ * Added support for the @public tag (applied to inner functions).
+ * @namespace tag can now be applied to functions, not just object literals.
+ * Added support for the -s command line option to suppress source code output.
+ * Added new unit test framework.
+ * Underscored symbols are now treated as if they have a @private tag by default.
8 templates/jsdoc/class.tmpl
View
@@ -86,7 +86,7 @@
!}&nbsp;</td>
<td class="nameDescription">
<div class="fixedFont">
- <b>{+ new Link().toSymbol(data.alias).inner('constructor')+}</b>{+ makeSignature(data.params) +}
+ <b>{+ new Link().toSymbol(data.alias).inner('constructor')+}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
</div>
<div class="description">{+resolveLinks(summarize(data.desc))+}</div>
</td>
@@ -226,7 +226,7 @@
if (data.isPrivate) output += "&lt;private&gt; ";
if (data.isInner) output += "&lt;inner&gt; ";
!}
- <b>{+ data.alias +}</b>{+ makeSignature(data.params) +}
+ <b>{+ data.alias +}</b><if test="classType != 'Namespace '">{+ makeSignature(data.params) +}</if>
</div>
<div class="description">
@@ -245,7 +245,7 @@
<for each="item" in="data.params">
<dt>
{+((item.type)?""+("<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type)+"}</span> ")) : "")+} <b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="defined(item.defaultValue)">, Default: {+item.defaultValue+}</if></i></if>
+ <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
</dt>
<dd>{+resolveLinks(item.desc)+}</dd>
</for>
@@ -410,7 +410,7 @@
<for each="item" in="member.params">
<dt>
{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="defined(item.defaultValue)">, Default: {+item.defaultValue+}</if></i></if>
+ <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
</dt>
<dd>{+resolveLinks(item.desc)+}</dd>
</for>
Please sign in to comment.
Something went wrong with that request. Please try again.