Report if a function isn't guaranteed to return

This commit is contained in:
dcodeIO
2018-01-19 04:16:18 +01:00
parent 7be4f9fabb
commit ef7a095494
9 changed files with 131 additions and 30 deletions

View File

@ -29,3 +29,10 @@ export function ifThenElseBlock(n: i32): bool {
assert(ifThenElseBlock(0) == false);
assert(ifThenElseBlock(1) == true);
export function ifAlwaysReturns(n: i32): bool {
if (n)
return true;
else
throw new Error("error");
}