Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rock now disallows returning values from void functions - Closes #449

  • Loading branch information...
commit c1b624f7d366629636c5129983fb0e3a749af71a 1 parent 2f5d578
@shamanas shamanas authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  source/rock/middle/Return.ooc
View
2  source/rock/middle/Return.ooc
@@ -56,6 +56,8 @@ Return: class extends Statement {
if(expr getType() == null || !expr getType() isResolved()) {
res wholeAgain(this, "expr type is unresolved"); return Response OK
+ } else if(retType void? && !expr getType() void?) {
+ res throwError(InconsistentReturn new(token, "Can't return a %s in function declared as not returning anything" format(expr getType() toString())))
}
} else {
if (returnArgs && returnArgs empty?() && !retType void?) {
Please sign in to comment.
Something went wrong with that request. Please try again.