chakra-core / ChakraCore

ChakraCore is an open source Javascript engine with a C API.
MIT License
9.06k stars 1.19k forks source link

Optional chaining #6973

Open ShortDevelopment opened 2 months ago

ShortDevelopment commented 2 months ago

This PR aims to add support for the stage-4 proposal optional-chaining. It's inspired by the work of @rhuanjl but uses a more hacky approach to parsing.

Goals

ToDo

Out of scope


Spec: Optional Chains Fixes #6349

ShortDevelopment commented 2 months ago

I'm currently working on function calls. At the moment it would just be handled as if no optional-chaining would be used ⇾ crash in js land

Edit: Function call should work now but this is not always propagated correctly (yet) Edit: Function calls should now work

ShortDevelopment commented 2 months ago

The jitted code currently crashes at this assertion (causing the test-failures) https://github.com/chakra-core/ChakraCore/blob/1f6e17c4c55231846596223eab8ab36360349fa3/lib/Backend/GlobOpt.cpp#L11384