mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 03:15:08 +00:00
LibJS: Add StringPrototype and make it the prototype of StringObject
This patch adds String.prototype.charAt() to demonstrate that prototype property lookup works, and that you can call a prototype function on an object, and it will do what you expect. :^)
This commit is contained in:
parent
f7c15d00c9
commit
2c5b9fb8f9
6 changed files with 109 additions and 0 deletions
|
@ -37,8 +37,12 @@ public:
|
|||
|
||||
virtual void visit_children(Visitor&) override;
|
||||
|
||||
const PrimitiveString* primitive_string() const { return m_string; }
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "StringObject"; }
|
||||
virtual bool is_string_object() const override { return true; }
|
||||
|
||||
PrimitiveString* m_string { nullptr };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue