RFR: 8156615:Catch parameter can be a BindingPattern in ES6 mode

Attila Szegedi szegedia at gmail.com
Tue Nov 8 14:10:00 UTC 2016


What Sundar said. Additionally:

+ if (exception instanceof IdentNode) {
+   this.exception = ((IdentNode) exception == null) ? null : ((IdentNode) exception).setIsInitializedHere();

First, casting an expression before a null comparison is silly :-).
Second, you don’t even need to check for exception == null as "exception instanceof IdentNode” implies that exception != null. So that line should just be:

+ if (exception instanceof IdentNode) {
+   this.exception = ((IdentNode) exception).setIsInitializedHere();

Attila.

> On 08 Nov 2016, at 04:45, Sundararajan Athijegannathan <sundararajan.athijegannathan at oracle.com> wrote:
> 
> You need to update Parser API implementation to handle catch parameter
> being expression - rather than an IdentNode.
> 
> => you need to
> 
> * add another getter in CatchNode to expose Expression
> 
> * Use it in IRTranslator (of Parser API impl.) to translate catch param
> as expression
> 
> * You need to check for expression param in codegen pipeline to throw
> "not yet implemented" error.
> 
> -Sundar
> 
> On 11/7/2016 9:40 PM, Srinivas Dama wrote:
>> Please review:
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8156615 
>> Webrev: http://cr.openjdk.java.net/~sdama/8156615/webrev.00/ 
>> 
>> Please note that, this contains only parsing support for catch parameter as BindingPattern or BindingIdentifier.
>> 
>> Regards,
>> Srinivas
> 



More information about the nashorn-dev mailing list