mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibJS: Add parsing and evaluation of private fields and methods
This commit is contained in:
parent
c7a6572789
commit
16cc82460f
Notes:
sideshowbarker
2024-07-18 02:07:57 +09:00
Author: https://github.com/davidot
Commit: 16cc82460f
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
9 changed files with 368 additions and 69 deletions
|
@ -478,11 +478,11 @@ Reference VM::resolve_binding(FlyString const& name, Environment* environment)
|
|||
// 7.3.32 InitializeInstanceElements ( O, constructor ), https://tc39.es/ecma262/#sec-initializeinstanceelements
|
||||
ThrowCompletionOr<void> VM::initialize_instance_elements(Object& object, ECMAScriptFunctionObject& constructor)
|
||||
{
|
||||
for (auto& field : constructor.fields()) {
|
||||
field.define_field(*this, object);
|
||||
if (auto* exception = this->exception())
|
||||
return JS::throw_completion(exception->value());
|
||||
}
|
||||
for (auto& method : constructor.private_methods())
|
||||
TRY(object.private_method_or_accessor_add(method));
|
||||
|
||||
for (auto& field : constructor.fields())
|
||||
TRY(object.define_field(field.name, field.initializer));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue