| 2319 | } |
| 2320 | |
| 2321 | static void adjust_result( compiler * c, int actual_location, |
| 2322 | int desired_location ) |
| 2323 | { |
| 2324 | if ( actual_location == desired_location ) |
| 2325 | ; |
| 2326 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_RETURN ) |
| 2327 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2328 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_NONE ) |
| 2329 | compile_emit( c, INSTR_POP, 0 ); |
| 2330 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_STACK ) |
| 2331 | compile_emit( c, INSTR_PUSH_RESULT, 0 ); |
| 2332 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_NONE ) |
| 2333 | ; |
| 2334 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_STACK ) |
| 2335 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2336 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_RETURN ) |
| 2337 | { |
| 2338 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2339 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2340 | } |
| 2341 | else |
| 2342 | assert( !"invalid result location" ); |
| 2343 | } |
| 2344 | |
| 2345 | static char const * parse_type( PARSE * parse ) |
| 2346 | { |
no test coverage detected