If the stored symbol is custom (non-global), it is allocated on the heap, and may not be visited by anyone else, so we must register it in order to keep it alive.
@@ -7,6 +7,7 @@
#pragma once
#include <AK/FlyString.h>
+#include <LibJS/Heap/Handle.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/StringOrSymbol.h>
@@ -186,7 +187,7 @@ private:
Type m_type { Type::Invalid };
u32 m_number { 0 };
FlyString m_string;
- Symbol* m_symbol { nullptr };
+ Handle<Symbol> m_symbol;
};
}