mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibJS: Add support for public fields in classes
This commit is contained in:
parent
3b6a8d1d53
commit
def8b44c40
9 changed files with 265 additions and 11 deletions
|
@ -63,6 +63,17 @@ public:
|
|||
// This is for IsSimpleParameterList (static semantics)
|
||||
bool has_simple_parameter_list() const { return m_has_simple_parameter_list; }
|
||||
|
||||
// [[Fields]]
|
||||
struct InstanceField {
|
||||
StringOrSymbol name;
|
||||
FunctionObject* initializer { nullptr };
|
||||
|
||||
void define_field(VM& vm, Object& receiver) const;
|
||||
};
|
||||
|
||||
Vector<InstanceField> const& fields() const { return m_fields; }
|
||||
void add_field(StringOrSymbol property_key, FunctionObject* initializer);
|
||||
|
||||
protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
|
@ -79,6 +90,7 @@ private:
|
|||
ConstructorKind m_constructor_kind = ConstructorKind::Base;
|
||||
ThisMode m_this_mode { ThisMode::Global };
|
||||
bool m_has_simple_parameter_list { false };
|
||||
Vector<InstanceField> m_fields;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue