Using a set/get accessor causes a runtime error if the descriptor is not yet initialized #12905
Labels
i: bug
outdated
A closed issue/PR that is archived due to age. Recommended to make a new issue
Spec: Private Methods
Bug Report
Current behavior
When accessing a get /set accessor before it's descriptor is created by the emitted code causes the error
TypeError Cannot read property 'get' of undefined
REPL
Input Code
Expected behavior
This should work. It works in node.
Possible Solution
Reorder the emit to put private static accessors before fields. Accessor declarations do not have side effects so it is safe to execute them first. After, we can emit static fields, which can have side effects, safely, and any dependency on the static private accessors will work correctly.
The text was updated successfully, but these errors were encountered: