mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- Remove `[?]` syntax. - Change `int!` to `int?` syntax. - New `fault` declarations. - Enum associated values can reference the calling enum.
30 lines
452 B
Plaintext
30 lines
452 B
Plaintext
// #target: macos-x64
|
|
module foo;
|
|
import std::io;
|
|
|
|
fault ABC;
|
|
|
|
fn void? test()
|
|
{
|
|
if ((ABC?!))
|
|
{ }
|
|
else
|
|
{}
|
|
}
|
|
fn void main()
|
|
{
|
|
(void)test();
|
|
}
|
|
|
|
/* #expect: foo.ll
|
|
|
|
define i64 @foo.test() #0 {
|
|
entry:
|
|
%error_var = alloca i64, align 8
|
|
store i64 ptrtoint (ptr @foo.ABC to i64), ptr %error_var, align 8
|
|
br label %guard_block
|
|
guard_block: ; preds = %entry
|
|
%0 = load i64, ptr %error_var, align 8
|
|
ret i64 %0
|
|
}
|