diff -r 1aec996cde2d -r f7e573226c2b jitcraft/Parser.cpp --- a/jitcraft/Parser.cpp Thu Jul 12 00:38:00 2012 -0700 +++ b/jitcraft/Parser.cpp Sat Jul 14 18:43:34 2012 -0700 @@ -625,6 +625,8 @@ if (!expr) return NULL; + encounteredReturn_ = true; + return new (pool_) ReturnStatement(pos, expr); } @@ -698,9 +700,6 @@ break; } - if (!expect(TOK_IF)) - return NULL; - SourcePosition pos = scanner_.begin(); if (!expect(TOK_LPAREN)) return NULL; @@ -958,6 +957,8 @@ return NULL; } + encounteredReturn_ = false; + Statement *body = NULL; if (token != TOK_FORWARD && token != TOK_NATIVE) { body = block(); @@ -966,7 +967,7 @@ } scope_ = scope_->enclosing(); - return new (pool_) FunctionStatement(pos, scope, fun, body, parameters); + return new (pool_) FunctionStatement(pos, scope, fun, body, parameters, encounteredReturn_); } ParseTree *