Unified · Split
| @@ -1331,7 +1331,7 @@ t_CKBOOL emit_engine_emit_return( Chuck_Emitter * emit, a_Stmt_Return stmt ) · 1330 unmodified lines | |||
| 1331 | return FALSE; | 1331 | return FALSE; |
| 1332 | 1332 | ||
| 1333 | // if return is an object type | 1333 | // if return is an object type |
| 1334 | if( isobj( emit->env, stmt->val->type ) ) | 1334 | if( stmt->val && isobj( emit->env, stmt->val->type ) ) |
| 1335 | { | 1335 | { |
| 1336 | // add reference (to be released by the function caller) | 1336 | // add reference (to be released by the function caller) |
| 1337 | emit->append( new Chuck_Instr_Reg_AddRef_Object3 ); | 1337 | emit->append( new Chuck_Instr_Reg_AddRef_Object3 ); |
| @@ -0,0 +1,7 @@ | |||
| 1 | // test to make sure that return works in a void function | ||
| 2 | fun void test() { | ||
| 3 | return; | ||
| 4 | } | ||
| 5 | |||
| 6 | test(); | ||
| 7 | <<< "success" >>>; | ||