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:`
25 lines
501 B
Plaintext
25 lines
501 B
Plaintext
// #target: macos-x64
|
|
module testing;
|
|
import std::io;
|
|
|
|
fn void main()
|
|
{
|
|
String[] s1;
|
|
String[] s2;
|
|
deep_equal(s1, s2);
|
|
}
|
|
|
|
macro bool deep_equal(a, b)
|
|
{
|
|
$switch $typeof(a).kindof:
|
|
$case SLICE:
|
|
if (a.len != b.len) return false;
|
|
foreach (i, x : a)
|
|
{
|
|
if (!deep_equal(x, b[i])) return false;
|
|
}
|
|
return true;
|
|
$default:
|
|
$assert(false); // #error: Compile time assert failed
|
|
$endswitch
|
|
} |