1.1 --- a/jitcraft/Parser.cpp Thu Jul 12 00:38:00 2012 -0700
1.2 +++ b/jitcraft/Parser.cpp Sat Jul 14 18:43:34 2012 -0700
1.3 @@ -625,6 +625,8 @@
1.4 if (!expr)
1.5 return NULL;
1.6
1.7 + encounteredReturn_ = true;
1.8 +
1.9 return new (pool_) ReturnStatement(pos, expr);
1.10 }
1.11
1.12 @@ -698,9 +700,6 @@
1.13 break;
1.14 }
1.15
1.16 - if (!expect(TOK_IF))
1.17 - return NULL;
1.18 -
1.19 SourcePosition pos = scanner_.begin();
1.20 if (!expect(TOK_LPAREN))
1.21 return NULL;
1.22 @@ -958,6 +957,8 @@
1.23 return NULL;
1.24 }
1.25
1.26 + encounteredReturn_ = false;
1.27 +
1.28 Statement *body = NULL;
1.29 if (token != TOK_FORWARD && token != TOK_NATIVE) {
1.30 body = block();
1.31 @@ -966,7 +967,7 @@
1.32 }
1.33
1.34 scope_ = scope_->enclosing();
1.35 - return new (pool_) FunctionStatement(pos, scope, fun, body, parameters);
1.36 + return new (pool_) FunctionStatement(pos, scope, fun, body, parameters, encounteredReturn_);
1.37 }
1.38
1.39 ParseTree *