History

fix compile error when returning from a void function

nshaheed committed 3 years ago

Commit 20ccb2f1 parent 327782c2 files · +8 −1Browse files

Showing the changes to src (2 of 2 files). Show all

Unified · Split

2 files
  1. src/core/chuck_emit.cpp +1 −1
  2. src/test/01-Basic/121.ck +7 −0
src/core/chuck_emit.cpp+1−1
@@ -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 type1333 // 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 );
src/test/01-Basic/121.ck+7−0
@@ -0,0 +1,7 @@
1// test to make sure that return works in a void function
2fun void test() {
3 return;
4}
5
6test();
7<<< "success" >>>;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t