Emits Global/Nonlocal opcodes for a comma-separated name list. For Global, also registers each name so subsequent loads/stores route through LoadGlobal/StoreGlobal. */
(&mut self, op: OpCode)
| 298 | |
| 299 | /* Emits Global/Nonlocal opcodes for a comma-separated name list. For Global, also registers each name so subsequent loads/stores route through LoadGlobal/StoreGlobal. */ |
| 300 | pub(super) fn emit_name_list(&mut self, op: OpCode) { |
| 301 | self.advance(); |
| 302 | loop { |
| 303 | let name = self.advance_text(); |
| 304 | let idx = self.chunk.push_name(&name); |
| 305 | self.chunk.emit(op, idx); |
| 306 | if matches!(op, OpCode::Global) { self.globals_decl.insert(name); } |
| 307 | if !self.eat_if(TokenType::Comma) { break; } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | pub(super) fn compile_block(&mut self) { self.compile_block_inner(false); } |
| 312 | pub(super) fn compile_block_body(&mut self) { self.compile_block_inner(true); } |