mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- `$for` "()" replaced by trailing ":" `$for (var $x = 0; $x < FOO; $x++)` -> `$for var $x = 0; $x < FOO; $x++:` - `$switch` "()" replaced by trailing ":" `$switch ($Type)` -> `$switch $Type:` - Empty `$switch` requires trailing ":" `$switch` -> `$switch:`
31 lines
386 B
Plaintext
31 lines
386 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
enum Vehicles
|
|
{
|
|
CAR,
|
|
PLANE
|
|
}
|
|
|
|
macro elements($Type)
|
|
{
|
|
int x;
|
|
$foreach $x : $Type.values:
|
|
x = $x.ordinal;
|
|
$endforeach;
|
|
}
|
|
|
|
fn void main()
|
|
{
|
|
elements(Vehicles);
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
entry:
|
|
%x = alloca i32, align 4
|
|
store i32 0, ptr %x, align 4
|
|
store i32 0, ptr %x, align 4
|
|
store i32 1, ptr %x, align 4
|
|
ret void
|
|
}
|