Allow void return type

This commit is contained in:
MrLetsplay 2024-03-21 13:52:05 +01:00
parent 47b3c3b2c0
commit 0a5fdf71a4
Signed by: mr
SSH Key Fingerprint: SHA256:0zWNiRisbQ4dq/CCQAaMLoF3UfkF5wKPXO7DcjfFBEU
2 changed files with 12 additions and 0 deletions

View File

@ -338,6 +338,10 @@ func compileFunctionWAT(function ParsedFunction) (string, error) {
returnTypes = function.ReturnType.Value.(TupleType).Types
}
if function.ReturnType.Type == Type_Void {
returnTypes = []Type{}
}
for _, t := range returnTypes {
funcWAT += "\t(result " + getWATType(t) + ")\n"
}

View File

@ -2,6 +2,14 @@ u64 add(u8 a, u8 b) {
return add(a - 1u8, a);
}
u64 add2(u64 a, u64 b) {
return a + b;
}
void a() {
}
(u8, u8) doNothing(u8 a, u8 b) {
return a, b;
}