Return statement

This commit is contained in:
Rafał Grodziński
2025-06-01 23:39:45 +09:00
parent fcfe6392a4
commit 2cecb456bb
4 changed files with 33 additions and 0 deletions

View File

@@ -31,6 +31,13 @@ string Statement::toString() {
}
case FUNCTION_DECLARATION:
return "FUNCTION " + name + "\n" + blockStatement->toString() + "\n;";
case RETURN: {
string value = "RETURN";
if (expression != nullptr) {
value += " " + expression->toString();
}
return value;
}
case INVALID:
return "INVALID";
}