mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-03 00:42:54 +00:00
LibJS: Add ObjectPrototype and implement hasOwnProperty()
All Objects will now have ObjectPrototype as their prototype, unless overridden.
This commit is contained in:
parent
f1f14945cf
commit
23b1d97b0d
Notes:
sideshowbarker
2024-07-19 08:17:46 +09:00
Author: https://github.com/awesomekling
Commit: 23b1d97b0d
8 changed files with 114 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/NativeFunction.h>
|
||||
#include <LibJS/Object.h>
|
||||
#include <LibJS/ObjectPrototype.h>
|
||||
#include <LibJS/StringPrototype.h>
|
||||
#include <LibJS/Value.h>
|
||||
|
||||
|
@ -39,6 +40,7 @@ Interpreter::Interpreter()
|
|||
: m_heap(*this)
|
||||
{
|
||||
m_global_object = heap().allocate<GlobalObject>();
|
||||
m_object_prototype = heap().allocate<ObjectPrototype>();
|
||||
m_string_prototype = heap().allocate<StringPrototype>();
|
||||
}
|
||||
|
||||
|
@ -140,6 +142,7 @@ void Interpreter::gather_roots(Badge<Heap>, HashTable<Cell*>& roots)
|
|||
{
|
||||
roots.set(m_global_object);
|
||||
roots.set(m_string_prototype);
|
||||
roots.set(m_object_prototype);
|
||||
|
||||
for (auto& scope : m_scope_stack) {
|
||||
for (auto& it : scope.variables) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue