mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Update .len for subarray to not require ()
This commit is contained in:
@@ -86,7 +86,7 @@ define Argh2 = func int(double, Bobo);
|
||||
func int sum_us(int... x)
|
||||
{
|
||||
int sum = 0;
|
||||
if (x.len() == 0) return 0;
|
||||
if (x.len == 0) return 0;
|
||||
sum += x[0] + sum_us(...x[1..^1]);
|
||||
return sum;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ define Frob = long;
|
||||
func int sumd(int[] x)
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < x.len(); i++) sum += x[i];
|
||||
for (int i = 0; i < x.len; i++) sum += x[i];
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ define Argh2 = func int(double, Bobo);
|
||||
func int sum_us(int... x)
|
||||
{
|
||||
int sum = 0;
|
||||
if (x.len() == 0) return 0;
|
||||
if (x.len == 0) return 0;
|
||||
sum += x[0] + sum_us(...x[1..^1]);
|
||||
return sum;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ define Frob = long;
|
||||
func int sumd(int[] x)
|
||||
{
|
||||
int sum = 0;
|
||||
for (int i = 0; i < x.len(); i++) sum += x[i];
|
||||
for (int i = 0; i < x.len; i++) sum += x[i];
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ func FooIterator Foo.iterator(Foo *f)
|
||||
|
||||
func bool FooIterator.next(FooIterator *it, int *value)
|
||||
{
|
||||
if (it.index == it.f.x.len()) return false;
|
||||
if (it.index == it.f.x.len) return false;
|
||||
*value = it.f.x[it.index++];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ macro FooIterator Foo.iterator(Foo *f)
|
||||
|
||||
macro bool FooIterator.next(FooIterator *it, int *value)
|
||||
{
|
||||
if (it.index == it.f.x.len()) return false;
|
||||
if (it.index == it.f.x.len) return false;
|
||||
*value = it.f.x[it.index++];
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user