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

Method ConstIndex

compile.go:522–535  ·  view source on GitHub ↗
(value LValue)

Source from the content-addressed store, hash-verified

520}
521
522func (fc *funcContext) ConstIndex(value LValue) int {
523 ctype := value.Type()
524 for i, lv := range fc.Proto.Constants {
525 if lv.Type() == ctype && lv == value {
526 return i
527 }
528 }
529 fc.Proto.Constants = append(fc.Proto.Constants, value)
530 v := len(fc.Proto.Constants) - 1
531 if v > opMaxArgBx {
532 raiseCompileError(fc, fc.Proto.LineDefined, "too many constants")
533 }
534 return v
535}
536func (fc *funcContext) BlockLocalVarsCount() int {
537 count := 0
538 for block := fc.Block; block != nil; block = block.Parent {

Callers 4

compileAssignStmtLeftFunction · 0.80
compileAssignStmtFunction · 0.80
compileExprFunction · 0.80
loadRkFunction · 0.80

Calls 2

raiseCompileErrorFunction · 0.85
TypeMethod · 0.65

Tested by

no test coverage detected