remove type hints from declarations

This commit is contained in:
2026-07-17 16:14:08 +02:00
parent 45171f688c
commit 165b5844de
13 changed files with 33 additions and 69 deletions

View File

@@ -73,25 +73,25 @@ func Array.concat[a: Array<$>, b: Array<$>] : Array<$>
mem.copy(b->data, new_array->data + a->size * 8, b->size * 8)
return new_array
func Array.quicksort[arr: Array<$>] : void
func Array.quicksort[arr: Array<i64>] : void
arr->_do_quicksort(0, arr->size - 1)
func Array._do_quicksort[arr: Array<$>, low: i64, high: i64] : void
func Array._do_quicksort[arr: Array<i64>, low: i64, high: i64] : void
if low < high
i := arr->_partition(low, high)
arr->_do_quicksort(low, i - 1)
arr->_do_quicksort(i + 1, high)
func Array._partition[arr: Array<$>, low: i64, high: i64] : i64
pivot : i64 = arr->nth(high)
func Array._partition[arr: Array<i64>, low: i64, high: i64] : i64
pivot := arr->nth(high)
i := low - 1
for j in (low)..high
if arr->nth(j) as i64 <= pivot
i += 1
temp : i64 = arr->nth(i)
temp := arr->nth(i)
arr->set(i, arr->nth(j))
arr->set(j, temp)
temp : i64 = arr->nth(i + 1)
temp := arr->nth(i + 1)
arr->set(i + 1, arr->nth(high))
arr->set(high, temp)
return i + 1
@@ -178,7 +178,7 @@ func HashMap.new[] : HashMap
func HashMap.insert[map: HashMap<$>, key: str, value: $] : void
index := HashMap._djb2(key)
current : HashMap._Node = map->table->nth(index)
current := map->table->nth(index)
while current as ptr
if current->key->equal(key)
@@ -194,7 +194,7 @@ func HashMap.insert[map: HashMap<$>, key: str, value: $] : void
func HashMap.get[map: HashMap<$>, key: str] : $, bool
index := HashMap._djb2(key)
current : HashMap._Node = map->table->nth(index)
current := map->table->nth(index)
while current as ptr
if current->key->equal(key)
@@ -205,7 +205,7 @@ func HashMap.get[map: HashMap<$>, key: str] : $, bool
func HashMap.delete[map: HashMap<$>, key: str] : void
index := HashMap._djb2(key)
current : HashMap._Node = map->table->nth(index)
current := map->table->nth(index)
prev := 0 as HashMap._Node
while current as ptr
@@ -225,7 +225,7 @@ func HashMap.delete[map: HashMap<$>, key: str] : void
func HashMap.keys[map: HashMap<$>] : Array<str>
out := [] as Array<str>
for i in 0..HashMap._TABLE_SIZE
current : HashMap._Node = map->table->nth(i)
current := map->table->nth(i)
while current as ptr
out->push(current->key)
current = current->next
@@ -233,7 +233,7 @@ func HashMap.keys[map: HashMap<$>] : Array<str>
func HashMap.free_with_keys[map: HashMap<$>] : void
for i in 0..HashMap._TABLE_SIZE
current : HashMap._Node = map->table->nth(i)
current := map->table->nth(i)
while current as ptr
tmp := current
current = current->next

View File

@@ -51,7 +51,7 @@ func i64.to_str_buf[n: i64, buf: ptr] : void
buf[1] = 0
return
neg : bool = n < 0
neg := n < 0
if neg
// MIN_I64 will fail but i so dont care
n = -n

View File

@@ -136,7 +136,7 @@ func os.list_directory[path: str] : Array<str>, bool
pos := 0
while pos < n
len := mem.read16(buf + pos + 16)
name : ptr = buf + pos + 19
name := buf + pos + 19
if name[0]
skip := false
// skip if name is exactly '.' or '..'

View File

@@ -233,7 +233,7 @@ func str.hex_encode[s: str, s_len: i64] : str
func str._hex_digit_to_int[d: u8] : u8
if d->is_digit()
return d - '0'
lower : u8 = d | 32
lower := d | 32
if lower >= 'a' && lower <= 'f'
return lower - 'a' + 10
panic("invalid hex digit passed to str._hex_digit_to_int")