ソースを参照

LibJS: Use HashTable::take_first in GetObjectPropertyIterator

This is a bit more idiomatic than
```c++
auto it = table.begin();
auto k = *it;
table.remove(it);
```
and also saves us from copying the stored value.
Hediadyoin1 2 年 前
コミット
1c8adac442
1 ファイル変更1 行追加3 行削除
  1. 1 3
      Userland/Libraries/LibJS/Bytecode/Op.cpp

+ 1 - 3
Userland/Libraries/LibJS/Bytecode/Op.cpp

@@ -939,9 +939,7 @@ ThrowCompletionOr<void> GetObjectPropertyIterator::execute_impl(Bytecode::Interp
                         return result_object;
                     }
 
-                    auto it = items.begin();
-                    auto key = *it;
-                    items.remove(it);
+                    auto key = items.take_first();
 
                     // If the key was already seen, skip over it (invariant no. 4)
                     auto result = seen_items.set(key);