fholm / IronJS

IronJS - A JavaScript implementation for .NET
http://ironjs.wordpress.com
Apache License 2.0
680 stars 79 forks source link

A conditional expression containing an assignment as its last element fails to compile. #26

Closed otac0n closed 13 years ago

otac0n commented 13 years ago

This case fails: true ? foo="a" : foo="b"; print(foo);

This case passes: true ? (foo="a") : (foo="b"); print(foo);

otac0n commented 13 years ago

These expressions should be roughly equivalent: true ? foo="a" : foo="b"; and foo = true ? "a" : "b";

However, my attempts to resolve this issue have been thwarted by the fact that swaping the binding power of the conditional causes this interpretation: true ? (foo="a") : (foo="b"); and (foo = true) ? "a" : "b";

Whereas using the binding power of Assignment to read the expression after the colon cause this interpretation: (true ? foo="a" : foo) = "b"; and foo = (true ? "a" : "b");

fholm commented 13 years ago

I'll look into it asap.

fholm commented 13 years ago

Fixed in commit 0220cabadb919