mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
* Require parenthesized assignment expressions in condition of 'if' statements #2716 * Move analysis to semantic checker and also check while. And update tests and release notes. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
34 lines
495 B
Plaintext
34 lines
495 B
Plaintext
import std;
|
|
|
|
fn void loop_start() => io::printn("Loop Start");
|
|
fn void loop_end() => io::printn("Loop End");
|
|
fn void do_something() => io::printn("Do something");
|
|
|
|
macro @thing(; @body())
|
|
{
|
|
loop_start();
|
|
@body();
|
|
loop_end();
|
|
}
|
|
|
|
fn void strcpy(char *s1, char *s2) {
|
|
while ((*s1++ = *s2++));
|
|
}
|
|
|
|
fn void main()
|
|
{
|
|
while (true) @thing()
|
|
{
|
|
do_something();
|
|
break;
|
|
};
|
|
for (;;) @thing()
|
|
{
|
|
do_something();
|
|
break;
|
|
};
|
|
if (true) @thing()
|
|
{
|
|
do_something();
|
|
};
|
|
} |