mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
LinkedHashMap: Fix head being null when initializing from map (#2334)
* LinkedHashMap: Fix head being null when initializing from map
This commit is contained in:
@@ -533,14 +533,9 @@ fn void LinkedHashMap.transfer(&map, LinkedEntry*[] new_table) @private
|
||||
fn void LinkedHashMap.put_all_for_create(&map, LinkedHashMap* other_map) @private
|
||||
{
|
||||
if (!other_map.count) return;
|
||||
foreach (LinkedEntry *e : other_map.table)
|
||||
{
|
||||
while (e)
|
||||
{
|
||||
map.put_for_create(e.key, e.value);
|
||||
e = e.next;
|
||||
}
|
||||
}
|
||||
other_map.@each(; Key key, Value value) {
|
||||
map.set(key, value);
|
||||
};
|
||||
}
|
||||
|
||||
fn void LinkedHashMap.put_for_create(&map, Key key, Value value) @private
|
||||
|
||||
@@ -136,6 +136,7 @@ fn void linked_map_copy()
|
||||
assert(key == expected_order[index]);
|
||||
index++;
|
||||
};
|
||||
assert(index == 3); // check if @each worked
|
||||
}
|
||||
|
||||
fn void linked_map_iterators()
|
||||
|
||||
Reference in New Issue
Block a user