2016-09-23 07:00:23 +01:00
|
|
|
const assert = @import("std").debug.assert;
|
|
|
|
|
|
|
|
var read_count: u64 = 0;
|
|
|
|
|
|
|
|
fn readOnce() -> %u64 {
|
|
|
|
read_count += 1;
|
|
|
|
return read_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
error InvalidDebugInfo;
|
|
|
|
|
|
|
|
enum FormValue {
|
|
|
|
Address: u64,
|
|
|
|
Other: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn doThing(form_id: u64) -> %FormValue {
|
2016-09-28 07:33:32 +01:00
|
|
|
@setFnStaticEval(this, false);
|
|
|
|
|
2016-09-23 07:00:23 +01:00
|
|
|
return switch (form_id) {
|
|
|
|
17 => FormValue.Address { %return readOnce() },
|
|
|
|
else => error.InvalidDebugInfo,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn switchProngReturnsErrorEnum() {
|
2016-09-28 07:33:32 +01:00
|
|
|
@setFnTest(this, true);
|
|
|
|
|
2016-09-23 07:00:23 +01:00
|
|
|
%%doThing(17);
|
|
|
|
assert(read_count == 1);
|
|
|
|
}
|