Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: Source/devtools/scripts/jsdoc-validator/tests/function.js

Issue 319733002: DevTools: [JsDocValidator] Be smarter about function name and JSDoc detection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix constructor detection for unnamed functions Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 function badFuncNoAnnotation() { 1 function badFuncNoAnnotation() {
2 return 1; // ERROR - no @return annotation. 2 return 1; // ERROR - no @return annotation.
3 } 3 }
4 4
5 /** 5 /**
6 * @return {number} 6 * @return {number}
7 */ 7 */
8 function badFuncAnnotatedButNoReturn() // ERROR - no @return annotation. 8 function badFuncAnnotatedButNoReturn() // ERROR - no @return annotation.
9 { 9 {
10 } 10 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 TypeOne.prototype = { 79 TypeOne.prototype = {
80 badApiMethodNoAnnotation: function() // ERROR - public method. 80 badApiMethodNoAnnotation: function() // ERROR - public method.
81 { 81 {
82 return 1; 82 return 1;
83 }, 83 },
84 84
85 _privateMethod: function() // OK - non-public method. 85 _privateMethod: function() // OK - non-public method.
86 { 86 {
87 var obj = {};
88
89 /**
90 * @constructor
91 * @param {number} val
92 */
93 obj["a"] = obj["b"] = function(val) { // OK - constructor
94 this.foo = val;
95 }
96
97 /**
98 * @param {number} val
99 */
100 obj["c"] = obj["d"] = function(val) { // ERROR - no @this
101 this.foo = val;
102 }
103
87 return 1; 104 return 1;
88 }, 105 },
89 106
90 methodTwo: function() 107 methodTwo: function()
91 { 108 {
92 function callback() // OK - not a method. 109 function callback() // OK - not a method.
93 { 110 {
94 return 1; 111 return 1;
95 } 112 }
96 }, 113 },
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 * @param {string} a 358 * @param {string} a
342 * @param {string} c 359 * @param {string} c
343 */ 360 */
344 function funcParamsMissingTag1(a, b, c) {} 361 function funcParamsMissingTag1(a, b, c) {}
345 362
346 /** 363 /**
347 * @param {string} a 364 * @param {string} a
348 */ 365 */
349 function funcParamsMissingTag2(a, b, c) {} 366 function funcParamsMissingTag2(a, b, c) {}
350 367
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698