| 2370 | } |
| 2371 | |
| 2372 | static void adjust_result( compiler * c, int actual_location, |
| 2373 | int desired_location ) |
| 2374 | { |
| 2375 | if ( actual_location == desired_location ) |
| 2376 | ; |
| 2377 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_RETURN ) |
| 2378 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2379 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_NONE ) |
| 2380 | compile_emit( c, INSTR_POP, 0 ); |
| 2381 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_STACK ) |
| 2382 | compile_emit( c, INSTR_PUSH_RESULT, 0 ); |
| 2383 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_NONE ) |
| 2384 | ; |
| 2385 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_STACK ) |
| 2386 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2387 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_RETURN ) |
| 2388 | { |
| 2389 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2390 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2391 | } |
| 2392 | else |
| 2393 | assert( !"invalid result location" ); |
| 2394 | } |
| 2395 | |
| 2396 | static char const * parse_type( PARSE * parse ) |
| 2397 | { |
no test coverage detected