(&mut self)
| 1721 | } |
| 1722 | |
| 1723 | fn end_scope(&mut self) { |
| 1724 | self.scope_depth -= 1; |
| 1725 | let mut pop_count = 0; |
| 1726 | |
| 1727 | while self.local_count > 0 && self.locals[self.local_count - 1].depth > self.scope_depth { |
| 1728 | if self.locals[self.local_count - 1].is_captured { |
| 1729 | // Must still handle captured variables one at a time |
| 1730 | if pop_count > 0 { |
| 1731 | self.emit(OpCode::Pop(pop_count)); |
| 1732 | pop_count = 0; |
| 1733 | } |
| 1734 | // Whenever the compiler reaches the end of a block, it discards all local |
| 1735 | // variables in that block and emits an OpCode::CloseUpvalue for each local variable |
| 1736 | self.emit(OpCode::CloseUpvalue); |
| 1737 | } else { |
| 1738 | pop_count += 1; |
| 1739 | } |
| 1740 | self.local_count -= 1; |
| 1741 | } |
| 1742 | |
| 1743 | if pop_count > 0 { |
| 1744 | self.emit(OpCode::Pop(pop_count)); |
| 1745 | } |
| 1746 | } |
| 1747 | |
| 1748 | // Constants and identifiers |
| 1749 | fn make_constant(&mut self, value: Value<'gc>) -> usize { |
no test coverage detected