| 2314 | _current_block = id; |
| 2315 | } |
| 2316 | id leave_block_and_kill() override |
| 2317 | { |
| 2318 | if (!is_in_block()) |
| 2319 | return 0; |
| 2320 | |
| 2321 | std::string &code = _blocks.at(_current_block); |
| 2322 | |
| 2323 | code += "\tdiscard;\n"; |
| 2324 | |
| 2325 | const type &return_type = _current_function->return_type; |
| 2326 | if (!return_type.is_void()) |
| 2327 | { |
| 2328 | // Add a return statement to exit functions in case discard is the last control flow statement |
| 2329 | code += "\treturn "; |
| 2330 | write_constant(code, return_type, constant()); |
| 2331 | code += ";\n"; |
| 2332 | } |
| 2333 | else |
| 2334 | { |
| 2335 | code += "\treturn;\n"; |
| 2336 | } |
| 2337 | |
| 2338 | return set_block(0); |
| 2339 | } |
| 2340 | id leave_block_and_return(id value) override |
| 2341 | { |
| 2342 | if (!is_in_block()) |
nothing calls this directly
no test coverage detected