| OLD | NEW |
| 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 Loading... |
| 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 }; |
| OLD | NEW |