Update .len for subarray to not require ()

This commit is contained in:
Christoffer Lerno
2021-09-10 19:44:27 +02:00
parent 0aef2810c8
commit b7e423adc2
11 changed files with 23 additions and 34 deletions

View File

@@ -101,7 +101,7 @@ func void testArrays()
{
printf("index[%d]: %d\n", i, a);
}
printf("Length is a runtime value: %d\n", y.len());
printf("Length is a runtime value: %d\n", y.len);
puts("Getting a slice from the beginning to an offset of the end---");
y = x[..^2]; // Same as x[0..^2]
foreach (i, a : y)

View File

@@ -26,9 +26,9 @@ struct TopoList
public func void sort(InputPair[] pairs, uint elements)
{
printf(.x = "fe");
InputPair[] result = @array::make(InputPair, pairs.len());
InputPair[] result = @array::make(InputPair, pairs.len);
TopoList* top = mem::calloc(TopoList.sizeof, elements);
for (int i = 0; i < pairs.len(); i++)
for (int i = 0; i < pairs.len; i++)
{
InputPair pair = pairs[i];
assert(pair.value >= 0 && pair.value < elements);