Finishes a `[]` list after the first element; mirrors `dict_tail` with `ListExtend`/`ListAppend` and `BuildList`. */
(&mut self, mut count: u16, mut incremental: bool)
| 134 | |
| 135 | /* Finishes a `[]` list after the first element; mirrors `dict_tail` with `ListExtend`/`ListAppend` and `BuildList`. */ |
| 136 | fn list_tail(&mut self, mut count: u16, mut incremental: bool) { |
| 137 | while self.eat_if(TokenType::Comma) { |
| 138 | if matches!(self.peek(), Some(TokenType::Rsqb)) { break; } |
| 139 | if self.eat_if(TokenType::Star) { |
| 140 | if !incremental { self.chunk.emit(OpCode::BuildList, count); incremental = true; } |
| 141 | self.expr(); |
| 142 | self.chunk.emit(OpCode::ListExtend, 0); |
| 143 | } else { |
| 144 | self.expr(); |
| 145 | if incremental { self.chunk.emit(OpCode::ListAppend, 0); } else { count += 1; } |
| 146 | } |
| 147 | } |
| 148 | self.eat(TokenType::Rsqb); |
| 149 | if !incremental { self.chunk.emit(OpCode::BuildList, count); } |
| 150 | } |
| 151 | |
| 152 | /* Emits for/if comprehension scaffolding; reinjcts body with loop-bound SSA slots. */ |
| 153 | pub(super) fn comprehension_loop(&mut self, elem_bodies: &[(usize, Vec<Instruction>)], append_op: OpCode, versions_before: &HashMap<String, u32>) { |
no test coverage detected