mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
LibJS: Remove unnecessary FunctionObject::name() virtual
This allows us to remove the BoundFunction::m_name field, which we were initializing with a formatted FlyString on every function binding, despite never using it for anything.
This commit is contained in:
parent
6bd2cf3195
commit
4a5863bcdb
Notes:
github-actions[bot]
2025-04-10 02:01:55 +00:00
Author: https://github.com/awesomekling
Commit: 4a5863bcdb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4305
11 changed files with 5 additions and 26 deletions
|
@ -1212,14 +1212,14 @@ inline ThrowCompletionOr<void> put_by_property_key(VM& vm, Value base, Value thi
|
|||
switch (kind) {
|
||||
case Op::PropertyKind::Getter: {
|
||||
auto& function = value.as_function();
|
||||
if (function.name().is_empty() && is<ECMAScriptFunctionObject>(function))
|
||||
if (is<ECMAScriptFunctionObject>(function) && static_cast<ECMAScriptFunctionObject const&>(function).name().is_empty())
|
||||
static_cast<ECMAScriptFunctionObject*>(&function)->set_name(MUST(String::formatted("get {}", name)));
|
||||
object->define_direct_accessor(name, &function, nullptr, Attribute::Configurable | Attribute::Enumerable);
|
||||
break;
|
||||
}
|
||||
case Op::PropertyKind::Setter: {
|
||||
auto& function = value.as_function();
|
||||
if (function.name().is_empty() && is<ECMAScriptFunctionObject>(function))
|
||||
if (is<ECMAScriptFunctionObject>(function) && static_cast<ECMAScriptFunctionObject const&>(function).name().is_empty())
|
||||
static_cast<ECMAScriptFunctionObject*>(&function)->set_name(MUST(String::formatted("set {}", name)));
|
||||
object->define_direct_accessor(name, nullptr, &function, Attribute::Configurable | Attribute::Enumerable);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue