Skip to content

Commit 46bb537

Browse files
fixed bug where slots len == 0
1 parent ab2f85b commit 46bb537

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

example/test.gila

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

22

3-
example fn(x:u32,y:u32) do
4-
return x+y
5-
end
6-
73

84

9-
result=example(44,55)
10-
print(result)
5+
foo fn() do
6+
return "hi"
7+
end
118

9+
foo()

src/codegen.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ impl SlotManager {
440440
// [5,6,8] -> [9,10,11]
441441
// [8,10,11] -> [12,13,14]
442442
pub fn find_contiguous_slots(&mut self, existing_slots: &Vec<u8>) -> Vec<u8> {
443+
if existing_slots.len() == 0 {
444+
return existing_slots.clone();
445+
}
443446
// Find the next unused slot (incrementally grow slot numbers)
444447

445448
// start at the current first slot, we want to check this first which

0 commit comments

Comments
 (0)