You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable defer parse for class members including constructors
We have the ability to defer parse any function except for class members (which includes explicit class constructors). Class members are basically parsed in the same way as object literal methods so it isn't very hard to support defer parsing for them since we already support defer parsing for object literal methods.
The main complication here is supporting the unusual text extents for class constructors. The class constructor function itself is what we will eventually bind to the name of the class. However, calling toString on the class name should print the text of the entire class. We also need to know the exact text extents for the constructor method in order to defer parse it. There's already a mechanism we use to adjust the beginning of the text extents for async methods so I've extended this to support adjusting the length of the extents as well. We used to keep track of an extra uint tacked-on to FunctionBody but I moved this into a struct of two uints stored in the AuxPtr array instead. This struct is only allocated for objects with unusual text extents.
Besides the text extents work, the remainder is mostly just bookkeeping various flags to let us know we're parsing a class constructor, derived constructor, class member, etc.
FieldWithBarrier(uint) m_cbStartOffset; // pUtf8Source is this many bytes from the start of the scriptContext's source buffer.
1844
1853
// This is generally the same as m_cchStartOffset unless the buffer has a BOM or other non-ascii characters
1845
-
FieldWithBarrier(uint) m_cbStartPrintOffset; // pUtf8Source is this many bytes from the start of the toString-relevant part of the scriptContext's source buffer.
0 commit comments