MCPcopy Index your code
hub / github.com/Shopify/go-lua / String

Method String

instructions.go:180–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

178func createAx(op opCode, a int) instruction { return instruction(op)<<posOp | instruction(a)<<posAx }
179
180func (i instruction) String() string {
181 op := i.opCode()
182 s := opNames[op]
183 switch opMode(op) {
184 case iABC:
185 s = fmt.Sprintf("%s %d", s, i.a())
186 if bMode(op) == opArgK && isConstant(i.b()) {
187 s = fmt.Sprintf("%s constant %d", s, constantIndex(i.b()))
188 } else if bMode(op) != opArgN {
189 s = fmt.Sprintf("%s %d", s, i.b())
190 }
191 if cMode(op) == opArgK && isConstant(i.c()) {
192 s = fmt.Sprintf("%s constant %d", s, constantIndex(i.c()))
193 } else if cMode(op) != opArgN {
194 s = fmt.Sprintf("%s %d", s, i.c())
195 }
196 case iAsBx:
197 s = fmt.Sprintf("%s %d", s, i.a())
198 if bMode(op) != opArgN {
199 s = fmt.Sprintf("%s %d", s, i.sbx())
200 }
201 case iABx:
202 s = fmt.Sprintf("%s %d", s, i.a())
203 if bMode(op) != opArgN {
204 s = fmt.Sprintf("%s %d", s, i.bx())
205 }
206 case iAx:
207 s = fmt.Sprintf("%s %d", s, i.ax())
208 }
209 return s
210}
211
212func opmode(t, a, b, c, m int) byte { return byte(t<<7 | a<<6 | b<<4 | c<<2 | m) }
213

Callers

nothing calls this directly

Calls 12

opCodeMethod · 0.95
aMethod · 0.95
bMethod · 0.95
cMethod · 0.95
sbxMethod · 0.95
bxMethod · 0.95
axMethod · 0.95
opModeFunction · 0.85
bModeFunction · 0.85
isConstantFunction · 0.85
constantIndexFunction · 0.85
cModeFunction · 0.85

Tested by

no test coverage detected