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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/scripts/jsdoc-validator/tests/function.js
diff --git a/Source/devtools/scripts/jsdoc-validator/tests/function.js b/Source/devtools/scripts/jsdoc-validator/tests/function.js
index 4995c937b70f0b331efd138dff3f8120d7d89dce..06710c6493bb9d864b01f758534e67da9e6dcfa3 100644
--- a/Source/devtools/scripts/jsdoc-validator/tests/function.js
+++ b/Source/devtools/scripts/jsdoc-validator/tests/function.js
@@ -84,6 +84,23 @@ TypeOne.prototype = {
_privateMethod: function() // OK - non-public method.
{
+ var obj = {};
+
+ /**
+ * @constructor
+ * @param {number} val
+ */
+ obj["a"] = obj["b"] = function(val) { // OK - constructor
+ this.foo = val;
+ }
+
+ /**
+ * @param {number} val
+ */
+ obj["c"] = obj["d"] = function(val) { // ERROR - no @this
+ this.foo = val;
+ }
+
return 1;
},

Powered by Google App Engine
This is Rietveld 408576698