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

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/jsdoc-validator/tests/this.js

Issue 2449173002: DevTools: fix jsdoc validator to recognize `this' usage within arrow functions (Closed)
Patch Set: review comments + moar tests Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/jsdoc-validator/tests/golden.dat ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 this.foo = this.foo + 1; // OK - outside of function. 1 this.foo = this.foo + 1; // OK - outside of function.
2 2
3 function f() { 3 function f() {
4 this.foo = this.foo + 1; // OK - global |this|. 4 this.foo = this.foo + 1; // OK - global |this|.
5 } 5 }
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 */ 9 */
10 function TypeOne() { 10 function TypeOne() {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 * @this {Object} 275 * @this {Object}
276 */ 276 */
277 function callbackNotReferencingThisAnnotated() 277 function callbackNotReferencingThisAnnotated()
278 { 278 {
279 } 279 }
280 this.memberTwo(callbackNotReferencingThisAnnotated); // OK - Has @this a nnotation, but does not reference |this|. 280 this.memberTwo(callbackNotReferencingThisAnnotated); // OK - Has @this a nnotation, but does not reference |this|.
281 }, 281 },
282 282
283 memberTwo: function(arg) {} 283 memberTwo: function(arg) {}
284 } 284 }
285
286 /**
287 * @constructor
288 */
289 function ReceiverWithArrowsTest()
290 {
291 this._q = [];
292 }
293
294 ReceiverWithArrowsTest.prototype = {
295 /**
296 * @param {string} s
297 */
298 memberOne: function(s)
299 {
300 /**
301 * @param {string} a
302 * @this {C}
303 */
304 function testArrowFunctionReferencingThis(a)
305 {
306 (x => this._q.push(x))(a);
307 }
308
309 /**
310 * @param {string} a
311 * @this {C}
312 */
313 function testNestedArrowFunctionReferencingThis(a)
314 {
315 (x => (y => this._q.push(y))(x))(a);
316 }
317
318 /**
319 * @param {string} a
320 */
321 function testArrowFunctionReferencingThisMissingAnnotation(a)
322 {
323 (x => this._q.push(x))(a);
324 }
325
326 }
327 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/scripts/jsdoc-validator/tests/golden.dat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698