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

Srinivas Dama srinivas.dama at oracle.com
Thu Nov 10 11:46:34 UTC 2016


Hi,

Please review 
Bug: https://bugs.openjdk.java.net/browse/JDK-8156615 
webrev: http://cr.openjdk.java.net/~sdama/8156615/webrev.02/ 

Included all changes suggested with some modifications.

Regards,
Srinivas 

-----Original Message-----
From: Attila Szegedi [mailto:szegedia at gmail.com] 
Sent: Tuesday, November 08, 2016 7:40 PM
To: Nashorn-dev
Subject: Re: RFR: 8156615:Catch parameter can be a BindingPattern in ES6 mode

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