mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibJS: Add parsing and evaluation of private fields and methods
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 02:07:57 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/16cc82460f6 Pull-request: https://github.com/SerenityOS/serenity/pull/10470 Issue: https://github.com/SerenityOS/serenity/issues/7044 Issue: https://github.com/SerenityOS/serenity/issues/8574 Reviewed-by: https://github.com/linusg
@@ -59,14 +59,15 @@ public:
|
||||
void set_home_object(Object* home_object) { m_home_object = home_object; }
|
||||
|
||||
struct InstanceField {
|
||||
PropertyName name;
|
||||
Variant<PropertyName, PrivateName> name;
|
||||
ECMAScriptFunctionObject* initializer { nullptr };
|
||||
|
||||
void define_field(VM& vm, Object& receiver) const;
|
||||
};
|
||||
|
||||
Vector<InstanceField> const& fields() const { return m_fields; }
|
||||
void add_field(PropertyName property_key, ECMAScriptFunctionObject* initializer) { m_fields.empend(property_key, initializer); }
|
||||
void add_field(Variant<PropertyName, PrivateName> property_key, ECMAScriptFunctionObject* initializer);
|
||||
|
||||
Vector<PrivateElement> const& private_methods() const { return m_private_methods; }
|
||||
void add_private_method(PrivateElement method) { m_private_methods.append(move(method)); };
|
||||
|
||||
// This is for IsSimpleParameterList (static semantics)
|
||||
bool has_simple_parameter_list() const { return m_has_simple_parameter_list; }
|
||||
@@ -97,6 +98,7 @@ private:
|
||||
bool m_strict { false }; // [[Strict]]
|
||||
Object* m_home_object { nullptr }; // [[HomeObject]]
|
||||
Vector<InstanceField> m_fields; // [[Fields]]
|
||||
Vector<PrivateElement> m_private_methods; // [[PrivateMethods]]
|
||||
bool m_is_class_constructor { false }; // [[IsClassConstructor]]
|
||||
|
||||
FlyString m_name;
|
||||
|
||||
Reference in New Issue
Block a user