MCPcopy
hub / github.com/expr-lang/expr / emit

Method emit

compiler/compiler.go:122–135  ·  view source on GitHub ↗
(op Opcode, args ...int)

Source from the content-addressed store, hash-verified

120}
121
122func (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
137func (c *compiler) emitPush(value any) int {
138 return c.emit(OpPush, c.addConstant(value))

Callers 15

CompileFunction · 0.95
emitPushMethod · 0.95
emitFunctionMethod · 0.95
compileMethod · 0.95
NilNodeMethod · 0.95
IdentifierNodeMethod · 0.95
BoolNodeMethod · 0.95
ConstantNodeMethod · 0.95
UnaryNodeMethod · 0.95
BinaryNodeMethod · 0.95
equalBinaryNodeMethod · 0.95
ChainNodeMethod · 0.95

Calls 2

emitLocationMethod · 0.95
LocationMethod · 0.65

Tested by

no test coverage detected