(op Opcode, args ...int)
| 120 | } |
| 121 | |
| 122 | func (c *compiler) emit(op Opcode, args ...int) int { |
| 123 | arg := 0 |
| 124 | if len(args) > 1 { |
| 125 | panic("too many arguments") |
| 126 | } |
| 127 | if len(args) == 1 { |
| 128 | arg = args[0] |
| 129 | } |
| 130 | var loc file.Location |
| 131 | if len(c.nodes) > 0 { |
| 132 | loc = c.nodes[len(c.nodes)-1].Location() |
| 133 | } |
| 134 | return c.emitLocation(loc, op, arg) |
| 135 | } |
| 136 | |
| 137 | func (c *compiler) emitPush(value any) int { |
| 138 | return c.emit(OpPush, c.addConstant(value)) |
no test coverage detected