Commit 2f99af8 1 parent b561624 commit 2f99af8 Copy full SHA for 2f99af8
File tree 6 files changed +60
-0
lines changed
6 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -436,6 +436,12 @@ var DOCLET_SCHEMA = exports.DOCLET_SCHEMA = {
436
436
type : STRING
437
437
}
438
438
} ,
439
+ modifies : {
440
+ type : ARRAY ,
441
+ optional : true ,
442
+ uniqueItems : true ,
443
+ items : PARAM_SCHEMA
444
+ } ,
439
445
// probably a trailing substring of the path
440
446
name : {
441
447
type : STRING
Original file line number Diff line number Diff line change @@ -605,6 +605,13 @@ var baseTags = exports.baseTags = {
605
605
setDocletNameToValue ( doclet , tag ) ;
606
606
}
607
607
} ,
608
+ modifies : {
609
+ canHaveType : true ,
610
+ onTagged : function ( doclet , tag ) {
611
+ doclet . modifies = doclet . modifies || [ ] ;
612
+ doclet . modifies . push ( tag . value ) ;
613
+ }
614
+ } ,
608
615
module : {
609
616
canHaveType : true ,
610
617
isNamespace : true ,
@@ -910,6 +917,7 @@ exports.closureTags = {
910
917
} ) ,
911
918
lends : cloneTagDef ( baseTags . lends ) ,
912
919
license : cloneTagDef ( baseTags . license ) ,
920
+ modifies : cloneTagDef ( baseTags . modifies ) ,
913
921
// Closure Compiler only
914
922
noalias : {
915
923
onTagged : ignore
Original file line number Diff line number Diff line change @@ -77,6 +77,18 @@ var self = this;
77
77
<?js }); ?></ul>
78
78
<?js } ?>
79
79
80
+ <?js if (data.modifies && modifies.length) {?>
81
+ <h5>Modifies:</h5>
82
+ <?js if (modifies.length > 1) { ?><ul><?js
83
+ modifies.forEach(function(m) { ?>
84
+ <li><?js= self.partial('modifies.tmpl', m) ?></li>
85
+ <?js });
86
+ ?></ul><?js } else {
87
+ modifies.forEach(function(m) { ?>
88
+ <?js= self.partial('modifies.tmpl', m) ?>
89
+ <?js });
90
+ } } ?>
91
+
80
92
<?js if (data.exceptions && exceptions.length) { ?>
81
93
<h5>Throws:</h5>
82
94
<?js if (exceptions.length > 1) { ?><ul><?js
Original file line number Diff line number Diff line change
1
+ <?js
2
+ var data = obj || {};
3
+ ?>
4
+
5
+ <?js if (data.type && data.type.names) {?>
6
+ <dl>
7
+ <dt>
8
+ Type
9
+ </dt>
10
+ <dd>
11
+ <?js= this.partial('type.tmpl', data.type.names) ?>
12
+ </dd>
13
+ </dl>
14
+ <?js } ?>
Original file line number Diff line number Diff line change
1
+ /**
2
+ * My mutator function.
3
+ * @modifies {(foo|bar)}
4
+ */
5
+ function mutator ( foo , bar ) { }
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ describe ( '@modifies tag' , function ( ) {
4
+ var docSet = jasmine . getDocSetFromFile ( 'test/fixtures/modifiestag.js' ) ;
5
+ var mutator = docSet . getByLongname ( 'mutator' ) [ 0 ] ;
6
+
7
+ it ( 'should add the specified types to the doclet\'s `modifies` property' , function ( ) {
8
+ expect ( mutator . modifies . length ) . toBe ( 1 ) ;
9
+ expect ( mutator . modifies [ 0 ] . type ) . toBeDefined ( ) ;
10
+ expect ( mutator . modifies [ 0 ] . type . names ) . toBeDefined ( ) ;
11
+ expect ( mutator . modifies [ 0 ] . type . names . length ) . toBe ( 2 ) ;
12
+ expect ( mutator . modifies [ 0 ] . type . names [ 0 ] ) . toBe ( 'foo' ) ;
13
+ expect ( mutator . modifies [ 0 ] . type . names [ 1 ] ) . toBe ( 'bar' ) ;
14
+ } ) ;
15
+ } ) ;
You can’t perform that action at this time.
0 commit comments