mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 08:33:28 +02:00
SharedFunctionInstanceData::m_source_text is a Utf16View into the SourceCode that the function was parsed from. Previously, the SourceCode was kept alive transitively through the AST nodes. As we move towards dropping AST nodes after compilation, we need to ensure the SourceCode outlives the view. Add a RefPtr<SourceCode> to SharedFunctionInstanceData so m_source_text remains valid even after the AST is gone. This is needed for Function.prototype.toString which accesses source_text() at any point during the function's lifetime.
4.7 KiB
4.7 KiB