Skip to content

Commit e4bd611

Browse files
committed
Avoid extra copy/validation of keys in Dictionary::has_all
Updated Dictionary::has_all to check its HashMap directly for each validated key instead of going through Dictionary::has, to avoid additional copy/validation of each key.
1 parent e37c626 commit e4bd611

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/variant/dictionary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool Dictionary::has_all(const Array &p_keys) const {
225225
for (int i = 0; i < p_keys.size(); i++) {
226226
Variant key = p_keys[i];
227227
ERR_FAIL_COND_V(!_p->typed_key.validate(key, "use 'has_all'"), false);
228-
if (!has(key)) {
228+
if (!_p->variant_map.has(key)) {
229229
return false;
230230
}
231231
}

0 commit comments

Comments
 (0)