True means break statement loop
( context: &mut Context<'a, 'b>, generator: &mut G, statement: &'b Statement<'a>, block_start_defer_len: usize, should_generate_defer_stack: &mut bool, )
| 201 | |
| 202 | // True means break statement loop |
| 203 | fn generate_statement<'a, 'b, G: Generator>( |
| 204 | context: &mut Context<'a, 'b>, |
| 205 | generator: &mut G, |
| 206 | statement: &'b Statement<'a>, |
| 207 | block_start_defer_len: usize, |
| 208 | should_generate_defer_stack: &mut bool, |
| 209 | ) -> bool { |
| 210 | let debug_location = statement.debug_location; |
| 211 | |
| 212 | match &statement.kind { |
| 213 | StatementKind::Expression(expression) => { |
| 214 | generate_statement_expression(context, generator, expression); |
| 215 | |
| 216 | if let ExpressionKind::Call(call) = &expression.kind { |
| 217 | let is_noreturn = context.function_store.shapes.read()[call.function_id.function_shape_index] |
| 218 | .as_ref() |
| 219 | .unwrap() |
| 220 | .read() |
| 221 | .return_type |
| 222 | .item |
| 223 | .is_noreturn(context.type_store); |
| 224 | |
| 225 | if is_noreturn { |
| 226 | return true; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | StatementKind::When(block) => { |
| 232 | for statement in &block.statements { |
| 233 | if generate_statement(context, generator, statement, block_start_defer_len, should_generate_defer_stack) { |
| 234 | return true; |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | StatementKind::Block(block) => { |
| 240 | generate_block(context, generator, block); |
| 241 | } |
| 242 | |
| 243 | StatementKind::While(statement) => { |
| 244 | let start_index = context.defer_stack.len(); |
| 245 | context.loop_stack.push(DeferMarker { start_index }); |
| 246 | generate_while(context, generator, statement, debug_location); |
| 247 | context.loop_stack.pop(); |
| 248 | } |
| 249 | |
| 250 | StatementKind::For(statement) => { |
| 251 | let start_index = context.defer_stack.len(); |
| 252 | context.loop_stack.push(DeferMarker { start_index }); |
| 253 | generate_for(context, generator, statement, debug_location); |
| 254 | context.loop_stack.pop(); |
| 255 | } |
| 256 | |
| 257 | StatementKind::Binding(binding) => generate_binding(context, generator, binding, debug_location), |
| 258 | |
| 259 | StatementKind::Defer(statement) => { |
| 260 | context.defer_stack.push(&statement.statement); |
no test coverage detected