Constant folding removes array literal in boolean context

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Tue Oct 8 05:42:54 PDT 2013


Thanks André.

https://bugs.openjdk.java.net/browse/JDK-8026042

Wondering if our very limited constant folding for if and ternary nodes 
is worth it at all.

Hannes

Am 2013-10-08 09:10, schrieb André Bargull:
> Just a quick one this time:
> FoldConstants#leaveIfNode() and FoldConstants#leaveTernaryNode() need 
> to guard against ArrayLiteralNode:
>
> jjs> (function(){if([a]);})()
>
> Expected: throws ReferenceError
> Actual: no error
>
> jjs> [a] ? 1 : 2
>
> Expected: throws ReferenceError
> Actual: no error
>
>
> - André



More information about the nashorn-dev mailing list