sproutcore 0.9.13 → 0.9.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. data/History.txt +19 -0
  2. data/Manifest.txt +103 -26
  3. data/app_generators/sproutcore/templates/README +1 -1
  4. data/bin/sc-build +1 -1
  5. data/bin/sc-gen +0 -0
  6. data/bin/sc-ide +278 -0
  7. data/bin/sc-init +38 -0
  8. data/bin/sc-install +96 -0
  9. data/bin/sc-remove +94 -0
  10. data/bin/sc-server +4 -0
  11. data/bin/sc-update +94 -0
  12. data/bin/sproutcore +3 -14
  13. data/clients/sc_docs/controllers/docs.js +1 -1
  14. data/clients/sc_docs/models/doc.js +6 -0
  15. data/clients/sc_docs/views/doc_frame.js +1 -1
  16. data/clients/sc_test_runner/english.lproj/icons/small/next.png +0 -0
  17. data/clients/sc_test_runner/english.lproj/icons/small/reset.png +0 -0
  18. data/frameworks/sproutcore/HISTORY +34 -2
  19. data/frameworks/sproutcore/controllers/array.js +1 -1
  20. data/frameworks/sproutcore/controllers/controller.js +1 -1
  21. data/frameworks/sproutcore/controllers/object.js +9 -6
  22. data/frameworks/sproutcore/core.js +19 -4
  23. data/frameworks/sproutcore/english.lproj/blank.gif +0 -0
  24. data/frameworks/sproutcore/english.lproj/core.css +1 -0
  25. data/frameworks/sproutcore/english.lproj/menu.css +1 -0
  26. data/frameworks/sproutcore/foundation/application.js +3 -3
  27. data/frameworks/sproutcore/foundation/benchmark.js +1 -1
  28. data/frameworks/sproutcore/foundation/node_descriptor.js +13 -1
  29. data/frameworks/sproutcore/foundation/page.js +3 -2
  30. data/frameworks/sproutcore/foundation/path_module.js +33 -16
  31. data/frameworks/sproutcore/foundation/run_loop.js +1 -1
  32. data/frameworks/sproutcore/foundation/server.js +68 -18
  33. data/frameworks/sproutcore/foundation/string.js +1 -1
  34. data/frameworks/sproutcore/globals/window.js +62 -15
  35. data/frameworks/sproutcore/lib/core_views.rb +1 -0
  36. data/frameworks/sproutcore/lib/index.rhtml +4 -3
  37. data/frameworks/sproutcore/lib/menu_views.rb +2 -2
  38. data/frameworks/sproutcore/models/collection.js +122 -107
  39. data/frameworks/sproutcore/models/record.js +2 -2
  40. data/frameworks/sproutcore/panes/manager.js +1 -1
  41. data/frameworks/sproutcore/panes/overlay.js +3 -3
  42. data/frameworks/sproutcore/tests/controllers/object.rhtml +26 -0
  43. data/frameworks/sproutcore/tests/views/collection/incremental_rendering.rhtml +2 -2
  44. data/frameworks/sproutcore/views/button/disclosure.js +1 -1
  45. data/frameworks/sproutcore/views/collection/collection.js +19 -15
  46. data/frameworks/sproutcore/views/collection/source_list.js +1 -1
  47. data/frameworks/sproutcore/views/collection/table.js +2 -2
  48. data/frameworks/sproutcore/views/error_explanation.js +1 -1
  49. data/frameworks/sproutcore/views/field/checkbox_field.js +1 -1
  50. data/frameworks/sproutcore/views/field/field.js +1 -1
  51. data/frameworks/sproutcore/views/field/radio_field.js +1 -1
  52. data/frameworks/sproutcore/views/field/select_field.js +1 -1
  53. data/frameworks/sproutcore/views/form.js +1 -1
  54. data/frameworks/sproutcore/views/image.js +1 -1
  55. data/frameworks/sproutcore/views/menu_item.js +1 -1
  56. data/frameworks/sproutcore/views/popup_button.js +1 -1
  57. data/frameworks/sproutcore/views/popup_menu.js +1 -1
  58. data/frameworks/sproutcore/views/progress.js +4 -2
  59. data/frameworks/sproutcore/views/radio_group.js +1 -1
  60. data/frameworks/sproutcore/views/scroll.js +1 -1
  61. data/frameworks/sproutcore/views/source_list_group.js +1 -1
  62. data/frameworks/sproutcore/views/split.js +1 -1
  63. data/frameworks/sproutcore/views/tab.js +3 -1
  64. data/frameworks/sproutcore/views/view.js +19 -3
  65. data/jsdoc/README.txt +89 -57
  66. data/jsdoc/app/frame/Chain.js +102 -0
  67. data/jsdoc/app/frame/Dumper.js +144 -0
  68. data/jsdoc/app/frame/Hash.js +47 -0
  69. data/jsdoc/app/frame/Link.js +142 -0
  70. data/jsdoc/app/frame/Namespace.js +10 -0
  71. data/jsdoc/app/frame/Opt.js +134 -0
  72. data/jsdoc/app/frame/Reflection.js +26 -0
  73. data/jsdoc/app/frame/String.js +93 -0
  74. data/jsdoc/app/frame/Testrun.js +129 -0
  75. data/jsdoc/app/frame.js +33 -0
  76. data/jsdoc/app/handlers/FOODOC.js +26 -0
  77. data/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
  78. data/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
  79. data/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
  80. data/jsdoc/app/handlers/XMLDOC.js +26 -0
  81. data/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
  82. data/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
  83. data/jsdoc/app/lib/JSDOC/JsDoc.js +180 -0
  84. data/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
  85. data/jsdoc/app/lib/JSDOC/Lang.js +144 -0
  86. data/jsdoc/app/lib/JSDOC/Parser.js +109 -0
  87. data/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
  88. data/jsdoc/app/lib/JSDOC/Symbol.js +600 -0
  89. data/jsdoc/app/lib/JSDOC/SymbolSet.js +220 -0
  90. data/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
  91. data/jsdoc/app/lib/JSDOC/Token.js +18 -0
  92. data/jsdoc/app/lib/JSDOC/TokenReader.js +323 -0
  93. data/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
  94. data/jsdoc/app/lib/JSDOC/Util.js +32 -0
  95. data/jsdoc/app/lib/JSDOC/Walker.js +416 -0
  96. data/jsdoc/app/lib/JSDOC.js +97 -0
  97. data/jsdoc/app/main.js +74 -0
  98. data/jsdoc/app/plugins/commentSrcJson.js +19 -0
  99. data/jsdoc/app/plugins/frameworkPrototype.js +16 -0
  100. data/jsdoc/app/plugins/functionCall.js +10 -0
  101. data/jsdoc/app/plugins/publishSrcHilite.js +62 -0
  102. data/jsdoc/app/plugins/sproutcoreTags.js +26 -0
  103. data/jsdoc/app/plugins/symbolLink.js +9 -0
  104. data/jsdoc/app/plugins/tagParamConfig.js +31 -0
  105. data/jsdoc/app/plugins/tagSynonyms.js +43 -0
  106. data/jsdoc/app/run.js +339 -137
  107. data/jsdoc/changes.txt +47 -0
  108. data/jsdoc/conf/sample.conf +31 -0
  109. data/jsdoc/java/build.xml +36 -0
  110. data/jsdoc/java/build_1.4.xml +36 -0
  111. data/jsdoc/java/classes/js.jar +0 -0
  112. data/jsdoc/java/src/JsDebugRun.java +21 -0
  113. data/jsdoc/java/src/JsRun.java +21 -0
  114. data/jsdoc/jsdebug.jar +0 -0
  115. data/jsdoc/jsrun.jar +0 -0
  116. data/jsdoc/t/TestDoc.js +144 -0
  117. data/jsdoc/t/runner.js +13 -0
  118. data/jsdoc/templates/sproutcore/allclasses.tmpl +17 -0
  119. data/jsdoc/templates/sproutcore/allfiles.tmpl +56 -0
  120. data/jsdoc/templates/sproutcore/class.tmpl +408 -326
  121. data/jsdoc/templates/sproutcore/index.tmpl +30 -31
  122. data/jsdoc/templates/sproutcore/publish.js +173 -81
  123. data/jsdoc/templates/sproutcore/static/default.css +191 -0
  124. data/jsdoc/templates/sproutcore/static/header.html +2 -0
  125. data/jsdoc/templates/sproutcore/static/index.html +19 -0
  126. data/jsdoc/templates/sproutcore/symbol.tmpl +35 -0
  127. data/jsdoc/test/addon.js +24 -0
  128. data/jsdoc/test/anon_inner.js +14 -0
  129. data/jsdoc/test/augments.js +31 -0
  130. data/jsdoc/test/augments2.js +26 -0
  131. data/jsdoc/test/borrows.js +41 -0
  132. data/jsdoc/test/borrows2.js +23 -0
  133. data/jsdoc/test/config.js +22 -0
  134. data/jsdoc/test/constructs.js +18 -0
  135. data/jsdoc/test/encoding.js +10 -0
  136. data/jsdoc/test/encoding_other.js +12 -0
  137. data/jsdoc/test/functions_anon.js +39 -0
  138. data/jsdoc/test/functions_nested.js +33 -0
  139. data/jsdoc/test/global.js +13 -0
  140. data/jsdoc/test/globals.js +25 -0
  141. data/jsdoc/test/ignore.js +10 -0
  142. data/jsdoc/test/inner.js +16 -0
  143. data/jsdoc/test/jsdoc_test.js +477 -0
  144. data/jsdoc/test/lend.js +33 -0
  145. data/jsdoc/test/memberof.js +20 -0
  146. data/jsdoc/test/memberof_constructor.js +15 -0
  147. data/jsdoc/test/name.js +19 -0
  148. data/jsdoc/test/namespace_nested.js +23 -0
  149. data/jsdoc/test/nocode.js +13 -0
  150. data/jsdoc/test/oblit_anon.js +20 -0
  151. data/jsdoc/test/overview.js +20 -0
  152. data/jsdoc/test/param_inline.js +37 -0
  153. data/jsdoc/test/params_optional.js +8 -0
  154. data/jsdoc/test/prototype.js +17 -0
  155. data/jsdoc/test/prototype_nested.js +9 -0
  156. data/jsdoc/test/prototype_oblit.js +13 -0
  157. data/jsdoc/test/prototype_oblit_constructor.js +24 -0
  158. data/jsdoc/test/public.js +10 -0
  159. data/jsdoc/test/shared.js +42 -0
  160. data/jsdoc/test/shared2.js +2 -0
  161. data/jsdoc/test/shortcuts.js +22 -0
  162. data/jsdoc/test/static_this.js +13 -0
  163. data/jsdoc/test/synonyms.js +23 -0
  164. data/jsdoc/test/tosource.js +23 -0
  165. data/jsdoc/test/variable_redefine.js +14 -0
  166. data/jsdoc/test.js +304 -0
  167. data/lib/sproutcore/build_tools/resource_builder.rb +6 -1
  168. data/lib/sproutcore/bundle_installer.rb +268 -0
  169. data/lib/sproutcore/jsdoc.rb +7 -6
  170. data/lib/sproutcore/library.rb +38 -0
  171. data/lib/sproutcore/merb/bundle_controller.rb +8 -4
  172. data/lib/sproutcore/version.rb +1 -1
  173. data/lib/sproutcore.rb +1 -1
  174. data/script/destroy +0 -0
  175. data/script/generate +0 -0
  176. data/script/txt2html +0 -0
  177. metadata +117 -29
  178. data/clients/view_builder/core.js +0 -19
  179. data/clients/view_builder/english.lproj/body.css +0 -149
  180. data/clients/view_builder/english.lproj/body.rhtml +0 -18
  181. data/clients/view_builder/english.lproj/strings.js +0 -14
  182. data/clients/view_builder/main.js +0 -37
  183. data/jsdoc/app/DocFile.js +0 -137
  184. data/jsdoc/app/DocTag.js +0 -110
  185. data/jsdoc/app/Doclet.js +0 -63
  186. data/jsdoc/app/Dumper.js +0 -143
  187. data/jsdoc/app/JsDoc.js +0 -103
  188. data/jsdoc/app/JsHilite.js +0 -45
  189. data/jsdoc/app/JsIO.js +0 -163
  190. data/jsdoc/app/JsParse.js +0 -385
  191. data/jsdoc/app/JsPlate.js +0 -130
  192. data/jsdoc/app/JsTestrun.js +0 -129
  193. data/jsdoc/app/JsToke.js +0 -564
  194. data/jsdoc/app/Symbol.js +0 -298
  195. data/jsdoc/app/Transformer.js +0 -14
  196. data/jsdoc/app/Util.js +0 -97
  197. data/jsdoc/app/js.jar +0 -0
  198. data/jsdoc/plugins/min.js +0 -316
  199. data/jsdoc/plugins/strip.js +0 -20
  200. data/jsdoc/templates/sproutcore/default.css +0 -191
  201. data/jsdoc/templates/sproutcore/index.html +0 -13
  202. data/jsdoc/templates/sproutcore/prototype.js +0 -4186
  203. data/jsdoc/templates/sproutcore/splash.html +0 -7
@@ -0,0 +1,600 @@
1
+ if (typeof JSDOC == "undefined") JSDOC = {};
2
+
3
+ /**
4
+ Create a new Symbol.
5
+ @class Represents a symbol in the source code.
6
+ */
7
+ JSDOC.Symbol = function() {
8
+ this.init();
9
+ if (arguments.length) this.populate.apply(this, arguments);
10
+ }
11
+
12
+ JSDOC.Symbol.prototype.init = function() {
13
+ this.$args = [];
14
+ this.addOn = "";
15
+ this.alias = "";
16
+ this.augments = [];
17
+ this.author = "";
18
+ this.classDesc = "";
19
+ this.comment = {};
20
+ this.defaultValue = undefined;
21
+ this.deprecated = "";
22
+ this.desc = "";
23
+ this.events = [];
24
+ this.example = [];
25
+ this.exceptions = [];
26
+ this.inherits = [];
27
+ this.inheritsFrom = [];
28
+ this.isa = "OBJECT";
29
+ this.isEvent = false;
30
+ this.isConstant = false;
31
+ this.isIgnored = false;
32
+ this.isInner = false;
33
+ this.isNamespace = false;
34
+ this.isPrivate = false;
35
+ this.isStatic = false;
36
+ this.memberOf = "";
37
+ this.methods = [];
38
+ this._name = "";
39
+ this._params = [];
40
+ this.properties = [];
41
+ this.requires = [];
42
+ this.returns = [];
43
+ this.see = [];
44
+ this.since = "";
45
+ this.srcFile = {};
46
+ this.type = "";
47
+ this.version = "";
48
+ }
49
+
50
+ JSDOC.Symbol.prototype.serialize = function() {
51
+ var keys = [];
52
+ for (var p in this) {
53
+ keys.push (p);
54
+ }
55
+ keys = keys.sort();
56
+
57
+ var out = "";
58
+ for (var i in keys) {
59
+ if (typeof this[keys[i]] == "function") continue;
60
+ out += keys[i]+": "+Dumper.dump(this[keys[i]])+",\n";
61
+ }
62
+ return "\n{\n" + out + "}\n";
63
+ }
64
+
65
+ JSDOC.Symbol.prototype.clone = function() {
66
+ var clone = new JSDOC.Symbol();
67
+ clone.populate.apply(clone, this.$args); // repopulate using the original arguments
68
+ clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made
69
+ return clone;
70
+ }
71
+
72
+ JSDOC.Symbol.prototype.__defineSetter__("name",
73
+ function(n) { n = n.replace(/^_global_[.#-]/, ""); n = n.replace(/\.prototype\.?/g, '#'); this._name = n; }
74
+ );
75
+ JSDOC.Symbol.prototype.__defineGetter__("name",
76
+ function() { return this._name; }
77
+ );
78
+ JSDOC.Symbol.prototype.__defineSetter__("params",
79
+ function(v) {
80
+ for (var i = 0, l = v.length; i < l; i++) {
81
+ if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...}
82
+ this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name);
83
+ }
84
+ else {
85
+ this._params[i] = v[i];
86
+ }
87
+ }
88
+ }
89
+ );
90
+ JSDOC.Symbol.prototype.__defineGetter__("params",
91
+ function() { return this._params; }
92
+ );
93
+
94
+ JSDOC.Symbol.prototype.populate = function(
95
+ /** String */ name,
96
+ /** Object[] */ params,
97
+ /** String */ isa,
98
+ /** JSDOC.DocComment */ comment
99
+ ) {
100
+ this.$args = arguments;
101
+
102
+ this.name = name;
103
+ this.alias = this.name;
104
+ this.params = params;
105
+ this.isa = (isa == "VIRTUAL")? "OBJECT":isa;
106
+ this.comment = comment || new JSDOC.DocComment("");
107
+ this.srcFile = JSDOC.Symbol.srcFile;
108
+
109
+ if (this.is("FILE") && !this.alias) this.alias = this.srcFile;
110
+
111
+ this.setTags();
112
+
113
+ if (typeof JSDOC.PluginManager != "undefined") {
114
+ JSDOC.PluginManager.run("onSymbol", this);
115
+ }
116
+ }
117
+
118
+ JSDOC.Symbol.prototype.setTags = function() {
119
+ // @author
120
+ var authors = this.comment.getTag("author");
121
+ if (authors.length) {
122
+ this.author = authors.map(function($){return $.desc;}).join(", ");
123
+ }
124
+
125
+ /*t:
126
+ plan(34, "testing JSDOC.Symbol");
127
+
128
+ requires("../lib/JSDOC/DocComment.js");
129
+ requires("../frame/String.js");
130
+ requires("../lib/JSDOC/DocTag.js");
131
+
132
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@author Joe Smith*"+"/"));
133
+ is(sym.author, "Joe Smith", "@author tag, author is found.");
134
+ */
135
+
136
+ // @desc
137
+ var descs = this.comment.getTag("desc");
138
+ if (descs.length) {
139
+ this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one
140
+ }
141
+
142
+ /*t:
143
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@desc This is a description.*"+"/"));
144
+ is(sym.desc, "This is a description.", "@desc tag, description is found.");
145
+ */
146
+
147
+ // @overview
148
+ if (this.is("FILE")) {
149
+ if (!this.alias) this.alias = this.srcFile;
150
+
151
+ var overviews = this.comment.getTag("overview");
152
+ if (overviews.length) {
153
+ this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n");
154
+ }
155
+ }
156
+
157
+ /*t:
158
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@overview This is an overview.*"+"/"));
159
+ is(sym.desc, "\nThis is an overview.", "@overview tag, description is found.");
160
+ */
161
+
162
+ // @since
163
+ var sinces = this.comment.getTag("since");
164
+ if (sinces.length) {
165
+ this.since = sinces.map(function($){return $.desc;}).join(", ");
166
+ }
167
+
168
+ /*t:
169
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@since 1.01*"+"/"));
170
+ is(sym.since, "1.01", "@since tag, description is found.");
171
+ */
172
+
173
+ // @constant
174
+ if (this.comment.getTag("constant").length) {
175
+ this.isConstant = true;
176
+ }
177
+
178
+ /*t:
179
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@constant*"+"/"));
180
+ is(sym.isConstant, true, "@constant tag, isConstant set.");
181
+ */
182
+
183
+ // @version
184
+ var versions = this.comment.getTag("version");
185
+ if (versions.length) {
186
+ this.version = versions.map(function($){return $.desc;}).join(", ");
187
+ }
188
+
189
+ /*t:
190
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@version 2.0x*"+"/"));
191
+ is(sym.version, "2.0x", "@version tag, version is found.");
192
+ */
193
+
194
+ // @deprecated
195
+ var deprecateds = this.comment.getTag("deprecated");
196
+ if (deprecateds.length) {
197
+ this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n");
198
+ }
199
+
200
+ /*t:
201
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@deprecated Use other method.*"+"/"));
202
+ is(sym.deprecated, "Use other method.", "@deprecated tag, desc is found.");
203
+ */
204
+
205
+ // @example
206
+ var examples = this.comment.getTag("example");
207
+ if (examples.length) {
208
+ this.example = examples.map(
209
+ // trim trailing whitespace
210
+ function($) {
211
+ $.desc = $.desc.replace(/\s+$/, "");
212
+ return $;
213
+ }
214
+ );
215
+ }
216
+
217
+ /*t:
218
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@example This\n is an example. \n*"+"/"));
219
+ isnt(typeof sym.example[0], "undefined", "@example tag, creates sym.example array.");
220
+ is(sym.example[0], "This\n is an example.", "@example tag, desc is found.");
221
+ */
222
+
223
+ // @see
224
+ var sees = this.comment.getTag("see");
225
+ if (sees.length) {
226
+ var thisSee = this.see;
227
+ sees.map(function($){thisSee.push($.desc);});
228
+ }
229
+
230
+ /*t:
231
+ var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@see The other thing.*"+"/"));
232
+ is(sym.see, "The other thing.", "@see tag, desc is found.");
233
+ */
234
+
235
+ // @class
236
+ var classes = this.comment.getTag("class");
237
+ if (classes.length) {
238
+ this.isa = "CONSTRUCTOR";
239
+ this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none.
240
+ }
241
+
242
+ /*t:
243
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@class This describes the class.*"+"/"));
244
+ is(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor.");
245
+ is(sym.classDesc, "This describes the class.", "@class tag, class description is found.");
246
+ */
247
+
248
+ // @namespace
249
+ var namespaces = this.comment.getTag("namespace");
250
+ if (namespaces.length) {
251
+ this.classDesc = namespaces[0].desc+"\n"+this.desc; // desc can't apply to the constructor as there is none.
252
+ this.isNamespace = true;
253
+ }
254
+
255
+ /*t:
256
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@namespace This describes the namespace.*"+"/"));
257
+ is(sym.classDesc, "This describes the namespace.\n", "@namespace tag, class description is found.");
258
+ */
259
+
260
+ // @param
261
+ var params = this.comment.getTag("param");
262
+ if (params.length) {
263
+ // user-defined params overwrite those with same name defined by the parser
264
+ var thisParams = this.params;
265
+
266
+ if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in
267
+ this.params = params;
268
+ }
269
+ else { // need to overlay these user-defined params on to existing parser-defined params
270
+ for (var i = 0, l = params.length; i < l; i++) {
271
+ if (thisParams[i]) {
272
+ if (params[i].type) thisParams[i].type = params[i].type;
273
+ thisParams[i].name = params[i].name;
274
+ thisParams[i].desc = params[i].desc;
275
+ thisParams[i].isOptional = params[i].isOptional;
276
+ thisParams[i].defaultValue = params[i].defaultValue;
277
+ }
278
+ else thisParams[i] = params[i];
279
+ }
280
+ }
281
+ }
282
+
283
+ /*t:
284
+ var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/"));
285
+ is(sym.params.length, 1, "parser defined param is found.");
286
+
287
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/"));
288
+ is(sym.params.length, 1, "user defined param is found.");
289
+ is(sym.params[0].type, "array", "user defined param type is found.");
290
+ is(sym.params[0].name, "pages", "user defined param name is found.");
291
+
292
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
293
+ is(sym.params.length, 1, "user defined param overwrites parser defined param.");
294
+ is(sym.params[0].type, "string", "user defined param type overwrites parser defined param type.");
295
+ is(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name.");
296
+
297
+ sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/"));
298
+ is(sym.params.length, 2, "user defined params overlay parser defined params.");
299
+ is(sym.params[1].type, "number", "user defined param type overlays parser defined param type.");
300
+ is(sym.params[1].name, "count", "user defined param name overlays parser defined param name.");
301
+
302
+ sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/"));
303
+ is(sym.params.length, 1, "user defined param with description is found.");
304
+ is(sym.params[0].desc, "The pages description.", "user defined param description is found.");
305
+ */
306
+
307
+ // @constructor
308
+ if (this.comment.getTag("constructor").length) {
309
+ this.isa = "CONSTRUCTOR";
310
+ }
311
+
312
+ /*t:
313
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@constructor*"+"/"));
314
+ is(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor.");
315
+ */
316
+
317
+ // @static
318
+ if (this.comment.getTag("static").length) {
319
+ this.isStatic = true;
320
+ if (this.isa == "CONSTRUCTOR") {
321
+ this.isNamespace = true;
322
+ }
323
+ }
324
+
325
+ /*t:
326
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@static\n@constructor*"+"/"));
327
+ is(sym.isStatic, true, "@static tag, makes isStatic true.");
328
+ is(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true.");
329
+ */
330
+
331
+ // @inner
332
+ if (this.comment.getTag("inner").length) {
333
+ this.isInner = true;
334
+ this.isStatic = false;
335
+ }
336
+
337
+ /*t:
338
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@inner*"+"/"));
339
+ is(sym.isStatic, false, "@inner tag, makes isStatic false.");
340
+ is(sym.isInner, true, "@inner makes isInner true.");
341
+ */
342
+
343
+ // @field
344
+ if (this.comment.getTag("field").length) {
345
+ this.isa = "OBJECT";
346
+ }
347
+
348
+ /*t:
349
+ var sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**@field*"+"/"));
350
+ is(sym.isa, "OBJECT", "@field tag, makes symbol an object.");
351
+ */
352
+
353
+ // @function
354
+ if (this.comment.getTag("function").length) {
355
+ this.isa = "FUNCTION";
356
+ }
357
+
358
+ /*t:
359
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@function*"+"/"));
360
+ is(sym.isa, "FUNCTION", "@function tag, makes symbol a function.");
361
+ */
362
+
363
+ // @event
364
+ var events = this.comment.getTag("event");
365
+ if (events.length) {
366
+ this.isa = "FUNCTION";
367
+ this.isEvent = true;
368
+ }
369
+
370
+ /*t:
371
+ var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@event*"+"/"));
372
+ is(sym.isa, "FUNCTION", "@event tag, makes symbol a function.");
373
+ is(sym.isEvent, true, "@event makes isEvent true.");
374
+ */
375
+
376
+ // @name
377
+ var names = this.comment.getTag("name");
378
+ if (names.length) {
379
+ this.name = names[0].desc;
380
+ }
381
+
382
+ /*t:
383
+ // todo
384
+ */
385
+
386
+ // @property
387
+ var properties = this.comment.getTag("property");
388
+ if (properties.length) {
389
+ thisProperties = this.properties;
390
+ for (var i = 0; i < properties.length; i++) {
391
+ var property = new JSDOC.Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new JSDOC.DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/"));
392
+ // TODO: shouldn't the following happen in the addProperty method of Symbol?
393
+ property.name = properties[i].name;
394
+ property.memberOf = this.alias;
395
+ if (properties[i].type) property.type = properties[i].type;
396
+ if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue;
397
+ this.addProperty(property);
398
+ JSDOC.Parser.addSymbol(property);
399
+ }
400
+ }
401
+
402
+ /*t:
403
+ // todo
404
+ */
405
+
406
+ // @return
407
+ var returns = this.comment.getTag("return");
408
+ if (returns.length) { // there can be many return tags in a single doclet
409
+ this.returns = returns;
410
+ this.type = returns.map(function($){return $.type}).join(", ");
411
+ }
412
+
413
+ /*t:
414
+ // todo
415
+ */
416
+
417
+ // @exception
418
+ this.exceptions = this.comment.getTag("throws");
419
+
420
+ /*t:
421
+ // todo
422
+ */
423
+
424
+ // @requires
425
+ var requires = this.comment.getTag("requires");
426
+ if (requires.length) {
427
+ this.requires = requires.map(function($){return $.desc});
428
+ }
429
+
430
+ /*t:
431
+ // todo
432
+ */
433
+
434
+ // @type
435
+ var types = this.comment.getTag("type");
436
+ if (types.length) {
437
+ this.type = types[0].desc; //multiple type tags are ignored
438
+ }
439
+
440
+ /*t:
441
+ // todo
442
+ */
443
+
444
+ // @private
445
+ if (this.comment.getTag("private").length || this.isInner) {
446
+ this.isPrivate = true;
447
+ }
448
+
449
+ // @ignore
450
+ if (this.comment.getTag("ignore").length) {
451
+ this.isIgnored = true;
452
+ }
453
+
454
+ /*t:
455
+ // todo
456
+ */
457
+
458
+ // @inherits ... as ...
459
+ var inherits = this.comment.getTag("inherits");
460
+ if (inherits.length) {
461
+ for (var i = 0; i < inherits.length; i++) {
462
+ if (/^\s*([a-z$0-9_.#-]+)(?:\s+as\s+([a-z$0-9_.#]+))?/i.test(inherits[i].desc)) {
463
+ var inAlias = RegExp.$1;
464
+ var inAs = RegExp.$2 || inAlias;
465
+
466
+ if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#");
467
+
468
+ if (inAs) {
469
+ inAs = inAs.replace(/\.prototype\.?/g, "#");
470
+ inAs = inAs.replace(/^this\.?/, "#");
471
+ }
472
+
473
+ if (inAs.indexOf(inAlias) != 0) { //not a full namepath
474
+ var joiner = ".";
475
+ if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") {
476
+ joiner = "";
477
+ }
478
+ inAs = this.alias + joiner + inAs;
479
+ }
480
+ }
481
+ this.inherits.push({alias: inAlias, as: inAs});
482
+ }
483
+ }
484
+
485
+ /*t:
486
+ // todo
487
+ */
488
+
489
+ // @augments
490
+ this.augments = this.comment.getTag("augments");
491
+
492
+ // @default
493
+ var defaults = this.comment.getTag("default");
494
+ if (defaults.length) {
495
+ if (this.is("OBJECT")) {
496
+ this.defaultValue = defaults[0].desc;
497
+ }
498
+ }
499
+
500
+ /*t:
501
+ // todo
502
+ */
503
+
504
+ // @memberOf
505
+ var memberOfs = this.comment.getTag("memberOf");
506
+ if (memberOfs.length) {
507
+ this.memberOf = memberOfs[0].desc;
508
+ this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#");
509
+ }
510
+
511
+ /*t:
512
+ // todo
513
+ */
514
+
515
+ // @public
516
+ if (this.comment.getTag("public").length) {
517
+ this.isPrivate = false;
518
+ }
519
+
520
+ /*t:
521
+ // todo
522
+ */
523
+ }
524
+
525
+ JSDOC.Symbol.prototype.is = function(what) {
526
+ return this.isa === what;
527
+ }
528
+
529
+ JSDOC.Symbol.prototype.isBuiltin = function() {
530
+ return JSDOC.Lang.isBuiltin(this.alias);
531
+ }
532
+
533
+ JSDOC.Symbol.prototype.setType = function(/**String*/comment, /**Boolean*/overwrite) {
534
+ if (!overwrite && this.type) return;
535
+ var typeComment = JSDOC.DocComment.unwrapComment(comment);
536
+ this.type = typeComment;
537
+ }
538
+
539
+ JSDOC.Symbol.prototype.inherit = function(symbol) {
540
+ if (!this.hasMember(symbol.name) && !symbol.isInner) {
541
+ if (symbol.is("FUNCTION"))
542
+ this.methods.push(symbol);
543
+ else if (symbol.is("OBJECT"))
544
+ this.properties.push(symbol);
545
+ }
546
+ }
547
+
548
+ JSDOC.Symbol.prototype.hasMember = function(name) {
549
+ return (this.hasMethod(name) || this.hasProperty(name));
550
+ }
551
+
552
+ JSDOC.Symbol.prototype.addMember = function(symbol) {
553
+ if (symbol.is("FUNCTION")) { this.addMethod(symbol); }
554
+ else if (symbol.is("OBJECT")) { this.addProperty(symbol); }
555
+ }
556
+
557
+ JSDOC.Symbol.prototype.hasMethod = function(name) {
558
+ var thisMethods = this.methods;
559
+ for (var i = 0, l = thisMethods.length; i < l; i++) {
560
+ if (thisMethods[i].name == name) return true;
561
+ if (thisMethods[i].alias == name) return true;
562
+ }
563
+ return false;
564
+ }
565
+
566
+ JSDOC.Symbol.prototype.addMethod = function(symbol) {
567
+ var methodAlias = symbol.alias;
568
+ var thisMethods = this.methods;
569
+ for (var i = 0, l = thisMethods.length; i < l; i++) {
570
+ if (thisMethods[i].alias == methodAlias) {
571
+ thisMethods[i] = symbol; // overwriting previous method
572
+ return;
573
+ }
574
+ }
575
+ thisMethods.push(symbol); // new method with this alias
576
+ }
577
+
578
+ JSDOC.Symbol.prototype.hasProperty = function(name) {
579
+ var thisProperties = this.properties;
580
+ for (var i = 0, l = thisProperties.length; i < l; i++) {
581
+ if (thisProperties[i].name == name) return true;
582
+ if (thisProperties[i].alias == name) return true;
583
+ }
584
+ return false;
585
+ }
586
+
587
+ JSDOC.Symbol.prototype.addProperty = function(symbol) {
588
+ var propertyAlias = symbol.alias;
589
+ var thisProperties = this.properties;
590
+ for (var i = 0, l = thisProperties.length; i < l; i++) {
591
+ if (thisProperties[i].alias == propertyAlias) {
592
+ thisProperties[i] = symbol; // overwriting previous property
593
+ return;
594
+ }
595
+ }
596
+
597
+ thisProperties.push(symbol); // new property with this alias
598
+ }
599
+
600
+ JSDOC.Symbol.srcFile = ""; //running reference to the current file being parsed