MCPcopy Index your code
hub / github.com/yuin/gopher-lua / findLocal

Method findLocal

state.go:754–773  ·  view source on GitHub ↗
(frame *callFrame, no int)

Source from the content-addressed store, hash-verified

752}
753
754func (ls *LState) findLocal(frame *callFrame, no int) string {
755 fn := frame.Fn
756 if !fn.IsG {
757 if name, ok := fn.LocalName(no, frame.Pc-1); ok {
758 return name
759 }
760 }
761 var top int
762 if ls.currentFrame == frame {
763 top = ls.reg.Top()
764 } else if frame.Idx+1 < ls.stack.Sp() {
765 top = ls.stack.At(frame.Idx + 1).Base
766 } else {
767 return ""
768 }
769 if top-frame.LocalBase >= no {
770 return "(*temporary)"
771 }
772 return ""
773}
774
775func (ls *LState) where(level int, skipg bool) string {
776 dbg, ok := ls.GetStack(level)

Callers 2

GetLocalMethod · 0.95
SetLocalMethod · 0.95

Calls 4

LocalNameMethod · 0.80
SpMethod · 0.65
AtMethod · 0.65
TopMethod · 0.45

Tested by

no test coverage detected