mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibJS: Put exports before symbols in keys of module namespace object
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 03:20:18 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/3b56043612 Pull-request: https://github.com/SerenityOS/serenity/pull/15100 Reviewed-by: https://github.com/linusg
@@ -210,16 +210,19 @@ ThrowCompletionOr<bool> ModuleNamespaceObject::internal_delete(PropertyKey const
|
||||
ThrowCompletionOr<MarkedVector<Value>> ModuleNamespaceObject::internal_own_property_keys() const
|
||||
{
|
||||
// 1. Let exports be O.[[Exports]].
|
||||
// NOTE: We only add the exports after we know the size of symbolKeys
|
||||
MarkedVector<Value> exports { vm().heap() };
|
||||
|
||||
// 2. Let symbolKeys be OrdinaryOwnPropertyKeys(O).
|
||||
auto symbol_keys = MUST(Object::internal_own_property_keys());
|
||||
|
||||
// 3. Return the list-concatenation of exports and symbolKeys.
|
||||
for (auto& export_name : m_exports) {
|
||||
symbol_keys.append(js_string(vm(), export_name));
|
||||
}
|
||||
exports.ensure_capacity(m_exports.size() + symbol_keys.size());
|
||||
for (auto const& export_name : m_exports)
|
||||
exports.unchecked_append(js_string(vm(), export_name));
|
||||
exports.extend(symbol_keys);
|
||||
|
||||
return symbol_keys;
|
||||
return exports;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user