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

Method dischargeToRegister

code.go:616–640  ·  view source on GitHub ↗
(e exprDesc, r int)

Source from the content-addressed store, hash-verified

614}
615
616func (f *function) dischargeToRegister(e exprDesc, r int) exprDesc {
617 switch e = f.DischargeVariables(e); e.kind {
618 case kindNil:
619 f.loadNil(r, 1)
620 case kindFalse:
621 f.EncodeABC(opLoadBool, r, 0, 0)
622 case kindTrue:
623 f.EncodeABC(opLoadBool, r, 1, 0)
624 case kindConstant:
625 f.EncodeConstant(r, e.info)
626 case kindNumber:
627 f.EncodeConstant(r, f.NumberConstant(e.value))
628 case kindRelocatable:
629 f.Instruction(e).setA(r)
630 case kindNonRelocatable:
631 if r != e.info {
632 f.EncodeABC(opMove, r, e.info, 0)
633 }
634 default:
635 f.assert(e.kind == kindVoid || e.kind == kindJump)
636 return e
637 }
638 e.kind, e.info = kindNonRelocatable, r
639 return e
640}
641
642func (f *function) dischargeToAnyRegister(e exprDesc) exprDesc {
643 if e.kind != kindNonRelocatable {

Callers 2

expressionToRegisterMethod · 0.95

Calls 8

DischargeVariablesMethod · 0.95
loadNilMethod · 0.95
EncodeABCMethod · 0.95
EncodeConstantMethod · 0.95
NumberConstantMethod · 0.95
InstructionMethod · 0.95
assertMethod · 0.95
setAMethod · 0.80

Tested by

no test coverage detected