mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
LibJS: Clarify Object (base class) construction somewhat
Divide the Object constructor into three variants: - The regular one (takes an Object& prototype) - One for use by GlobalObject - One for use by objects without a prototype (e.g ObjectPrototype)
This commit is contained in:
parent
fc4ed8d444
commit
ba641e97d9
33 changed files with 57 additions and 45 deletions
|
@ -62,7 +62,7 @@ class Object : public Cell {
|
|||
public:
|
||||
static Object* create_empty(Interpreter&, GlobalObject&);
|
||||
|
||||
explicit Object(Object* prototype);
|
||||
explicit Object(Object& prototype);
|
||||
virtual void initialize(Interpreter&, GlobalObject&) override;
|
||||
virtual ~Object();
|
||||
|
||||
|
@ -142,6 +142,12 @@ public:
|
|||
|
||||
Value invoke(const FlyString& property_name, Optional<MarkedValueList> arguments = {});
|
||||
|
||||
protected:
|
||||
enum class GlobalObjectTag { Tag };
|
||||
enum class ConstructWithoutPrototypeTag { Tag };
|
||||
explicit Object(GlobalObjectTag);
|
||||
Object(ConstructWithoutPrototypeTag, GlobalObject&);
|
||||
|
||||
private:
|
||||
virtual Value get_by_index(u32 property_index) const;
|
||||
virtual bool put_by_index(u32 property_index, Value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue