Review request for JDK-8151700: Add support for ES6 for-of

Hannes Wallnoefer hannes.wallnoefer at oracle.com
Thu Mar 24 10:24:39 UTC 2016


Thanks Sundar,

Am 2016-03-24 um 11:20 schrieb Sundararajan Athijegannathan:
> +1 with comments below:
>
> File: Lower.java
>
> + if(!es6 && (newForNode.isForIn() || newForNode.isForOf())) {
>
> why not isForInOrOf() there?

That's an oversight, fixing.
>
> There could be a negative tests to make sure "for.. of" results in
> SyntaxError in non-es6 mode.

There are negative tests in test/script/basic/es6.js (the file name is a 
bit misleading).

Hannes

> -Sundar
>
> On 3/24/2016 3:30 PM, Hannes Wallnoefer wrote:
>> Thanks Attila, I've uploaded a new webrev with the changes you suggested:
>>
>> http://cr.openjdk.java.net/~hannesw/8151700/webrev.01/
>>
>> Second review anybody?
>>
>> Hannes
>>
>> Am 2016-03-21 um 16:00 schrieb Attila Szegedi:
>>> It’s almost as if ForNode.isForInOrOf() should be a method :-)
>>>
>>> The methods of the Iterator in ScriptRuntime.toES6Iterator should
>>> have a pass-through catch block for Error too, e.g. instead of
>>> "catch(final RuntimeException r)” use “catch(final
>>> RuntimeException|Error r)”
>>>
>>> Other than this, +1.
>>>
>>> Attila.
>>>
>>>> On Mar 21, 2016, at 10:34 AM, Hannes Wallnoefer
>>>> <hannes.wallnoefer at oracle.com> wrote:
>>>>
>>>> Please review JDK-8151700: Add support for ES6 for-of:
>>>>
>>>> http://cr.openjdk.java.net/~hannesw/8151700/webrev/
>>>>
>>>> This enables ES6 for-of loops. The ES6 iterator is wrapped in a
>>>> java.util.Iterator so it uses the exact same codegen infrastructure
>>>> as for-in.
>>>>
>>>> Hannes



More information about the nashorn-dev mailing list