| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 /** | 258 /** |
| 259 * @suppressReceiverCheck | 259 * @suppressReceiverCheck |
| 260 * @this {Object} | 260 * @this {Object} |
| 261 */ | 261 */ |
| 262 function ignoredCallbackWithThis() | 262 function ignoredCallbackWithThis() |
| 263 { | 263 { |
| 264 this.foo = 1; | 264 this.foo = 1; |
| 265 } | 265 } |
| 266 object.callFunction(func, [], ignoredCallbackWithThis); // OK - ignored. | 266 object.callFunction(func, [], ignoredCallbackWithThis); // OK - ignored. |
| 267 |
| 268 function callbackReferencingThisNotAnnotated() |
| 269 { |
| 270 this.foo = 2; |
| 271 } |
| 272 this.memberTwo(callbackReferencingThisNotAnnotated.bind(this)); // OK -
No @this annotation, but references |this|. |
| 273 |
| 274 /** |
| 275 * @this {Object} |
| 276 */ |
| 277 function callbackNotReferencingThisAnnotated() |
| 278 { |
| 279 } |
| 280 this.memberTwo(callbackNotReferencingThisAnnotated); // OK - Has @this a
nnotation, but does not reference |this|. |
| 267 }, | 281 }, |
| 268 | 282 |
| 269 memberTwo: function(arg) {} | 283 memberTwo: function(arg) {} |
| 270 } | 284 } |
| OLD | NEW |