Compiles Indent/Dedent block; is_body=true stops after ReturnValue to skip dead code. */
(&mut self, is_body: bool)
| 313 | |
| 314 | /* Compiles Indent/Dedent block; is_body=true stops after ReturnValue to skip dead code. */ |
| 315 | fn compile_block_inner(&mut self, is_body: bool) { |
| 316 | let indented = self.eat_if(TokenType::Indent); |
| 317 | loop { |
| 318 | while self.eat_if(TokenType::Semi) {} |
| 319 | if self.at_end() { break; } |
| 320 | if matches!(self.peek(), Some(TokenType::Dedent)) { |
| 321 | self.advance(); |
| 322 | break; |
| 323 | } |
| 324 | let produced_value = self.stmt(); |
| 325 | if produced_value { |
| 326 | self.chunk.emit(OpCode::PopTop, 0); |
| 327 | } |
| 328 | if indented { continue; } |
| 329 | if is_body { |
| 330 | let just_returned = self.chunk.instructions.last().is_some_and(|i| i.opcode == OpCode::ReturnValue); |
| 331 | if just_returned || !matches!(self.peek(), Some(TokenType::Semi)) { break; } |
| 332 | } else if !matches!(self.peek(), Some(TokenType::Semi)) { break; } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /* Annotation: discard tokens up to `=`; Edge Python is dynamically typed. Returns true when an assignment follows. */ |
| 337 | fn skip_annotation(&mut self) -> bool { |
no test coverage detected