b581da41f8
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`, `setFnNoInline` builtin functions to replace previous directive functionality * add `coldcc` and `nakedcc` as keywords which can be used as part of a function prototype. * `setDebugSafety` builtin can be used to set debug safety features at a per block scope level. * closes #169
18 lines
359 B
Zig
18 lines
359 B
Zig
const assert = @import("std").debug.assert;
|
|
|
|
fn maybeReturn() {
|
|
@setFnTest(this, true);
|
|
|
|
assert(??foo(1235));
|
|
assert(if (const _ ?= foo(null)) false else true);
|
|
assert(!??foo(1234));
|
|
}
|
|
|
|
// TODO test static eval maybe return
|
|
fn foo(x: ?i32) -> ?bool {
|
|
@setFnStaticEval(this, false);
|
|
|
|
const value = ?return x;
|
|
return value > 1234;
|
|
}
|