RFR: 8164467: ES6 computed properties are implemented wrongly

Hannes Wallnöfer hannes.wallnoefer at oracle.com
Thu Sep 22 15:36:43 UTC 2016


Please review 8164467: ES6 computed properties are implemented wrongly.

Bug: https://bugs.openjdk.java.net/browse/JDK-8164467
Webrev: http://cr.openjdk.java.net/~hannesw/8164467/webrev.00/

This makes our support of ES6 computed property names fully spec compliant with one little exception: object literals with mixed computed and static property names should preserve iteration order of properties. Since we create a static property map of static properties and then add computed properties to those maps at runtime, computed properties are always at the end of iteration. I don’t know how to fix this, but I don’t consider it a big problem.

Other than that, the tests included in this patch pretty much mirror the tests in test262, minus the ones that require features we don’t yet support.

Although this changes the code for object literals in CodeGenerator a bit, ES5 code should not be affected, i.e. the code generated in absence of computed properties should be exactly the same as before. Same in Parser: I had to rewrite the code for reparsing ES6 methods a bit to handle methods with computed property names, but that should only affect that special case.

Thanks,
Hannes  


More information about the nashorn-dev mailing list