mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Bindings: Avoid second property index lookup for platform objects
While conceptually is_supported_property_index is a cheap index lookup, it is not currently cheap for an container such as HTMLAllCollection that is operating on an uncached collection. Instead - just do the lookup once. It also happens to look a little nicer to not blindly dereference an optional.
This commit is contained in:
parent
8a5985b87f
commit
22969a8e92
Notes:
github-actions[bot]
2024-07-26 12:27:06 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/22969a8e929 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/827
1 changed files with 2 additions and 2 deletions
|
@ -91,12 +91,12 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> PlatformObject::legacy_p
|
|||
u32 index = property_name.as_number();
|
||||
|
||||
// 2. If index is a supported property index, then:
|
||||
if (is_supported_property_index(index)) {
|
||||
if (auto maybe_value = item_value(index); maybe_value.has_value()) {
|
||||
// 1. Let operation be the operation used to declare the indexed property getter.
|
||||
// 2. Let value be an uninitialized variable.
|
||||
// 3. If operation was defined without an identifier, then set value to the result of performing the steps listed in the interface description to determine the value of an indexed property with index as the index.
|
||||
// 4. Otherwise, operation was defined with an identifier. Set value to the result of performing the method steps of operation with O as this and « index » as the argument values.
|
||||
auto value = *item_value(index);
|
||||
auto value = maybe_value.release_value();
|
||||
|
||||
// 5. Let desc be a newly created Property Descriptor with no fields.
|
||||
JS::PropertyDescriptor descriptor;
|
||||
|
|
Loading…
Reference in a new issue