greensock / GreenSock-AS3

Public repository for GreenSock's ActionScript 3 libraries like GSAP (TweenLite, TweenMax, etc.) and LoaderMax. For AS2, see the GreenSock-AS2 repository and for JavaScript, see the GreenSock-JS repository. Main site: http://www.greensock.com
409 stars 144 forks source link

Assignment within conditional #10

Closed iszard closed 9 years ago

iszard commented 9 years ago

Just downloaded what I'm assuming was the latest zip build from the greensock site. Once I uploaded into Flash Builder, it was quick to point out that in the file

TweenPlugin.as : com.greensock.plugins

Line 285 : if ((pt._prev = pt2 ? pt2._prev : last)) { Line 290 : if ((pt._next = pt2)) {

Should the ='s not be doubled? ==

jackdoyle commented 9 years ago

Nope, that's perfectly valid code and it's very purposeful. It is a speed and file size optimization. Flash Builder is just assuming that we probably meant == since it's a common mistake. That's why it's a "warning", not an "error".

To be clear, this: if ((pt._next = pt2)) {

Is the same as this: pt._next = pt2; if (pt._next !== null) {

iszard commented 9 years ago

thanks for the clarification.

On Thu, May 14, 2015 at 3:48 PM, jackdoyle notifications@github.com wrote:

Nope, that's perfectly valid code and it's very purposeful. It is a speed and file size optimization. Flash Builder is just assuming that we probably meant == since it's a common mistake. That's why it's a "warning", not an "error".

To be clear, this: if ((pt._next = pt2)) {

Is the same as this: pt._next = pt2; if (pt._next !== null) {

— Reply to this email directly or view it on GitHub https://github.com/greensock/GreenSock-AS3/issues/10#issuecomment-102148468 .