Open ShortDevelopment opened 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
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
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
eval?.('a')
)eval
)this
(a.b)().c
should be equivalent toa.b().c
apply
call optimization?a?.[++x]
++x
should not be evaluated ifa
isnull
orundefined
a?.3:0
(ternary) astkOptChain
(?.
)tmp
-renaming foreval
resulteval("foo?.()")
oreval("foo?.property")
Out of scope
EmitInvoke
(seems unused)Spec: Optional Chains Fixes #6349