| 2540 | } |
| 2541 | |
| 2542 | static void adjust_result( compiler * c, int32_t actual_location, |
| 2543 | int32_t desired_location ) |
| 2544 | { |
| 2545 | if ( actual_location == desired_location ) |
| 2546 | ; |
| 2547 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_RETURN ) |
| 2548 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2549 | else if ( actual_location == RESULT_STACK && desired_location == RESULT_NONE ) |
| 2550 | compile_emit( c, INSTR_POP, 0 ); |
| 2551 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_STACK ) |
| 2552 | compile_emit( c, INSTR_PUSH_RESULT, 0 ); |
| 2553 | else if ( actual_location == RESULT_RETURN && desired_location == RESULT_NONE ) |
| 2554 | ; |
| 2555 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_STACK ) |
| 2556 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2557 | else if ( actual_location == RESULT_NONE && desired_location == RESULT_RETURN ) |
| 2558 | { |
| 2559 | compile_emit( c, INSTR_PUSH_EMPTY, 0 ); |
| 2560 | compile_emit( c, INSTR_SET_RESULT, 0 ); |
| 2561 | } |
| 2562 | else |
| 2563 | assert( !"invalid result location" ); |
| 2564 | } |
| 2565 | |
| 2566 | static void compile_append_chain( PARSE * parse, compiler * c ) |
| 2567 | { |
no test coverage detected