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

Function protectedParser

parser.go:673–697  ·  view source on GitHub ↗
(l *State, r io.Reader, name, chunkMode string)

Source from the content-addressed store, hash-verified

671}
672
673func protectedParser(l *State, r io.Reader, name, chunkMode string) error {
674 l.nonYieldableCallCount++
675 err := l.protectedCall(func() {
676 var closure *luaClosure
677 b := bufio.NewReader(r)
678 if c, err := b.ReadByte(); err != nil {
679 l.checkMode(chunkMode, "text")
680 closure = l.parse(b, name)
681 } else if c == Signature[0] {
682 l.checkMode(chunkMode, "binary")
683 b.UnreadByte()
684 closure, _ = l.undump(b, name) // TODO handle err
685 } else {
686 l.checkMode(chunkMode, "text")
687 b.UnreadByte()
688 closure = l.parse(b, name)
689 }
690 l.assert(closure.upValueCount() == len(closure.prototype.upValues))
691 for i := range closure.upValues {
692 closure.upValues[i] = l.newUpValue()
693 }
694 }, l.top, l.errorFunction)
695 l.nonYieldableCallCount--
696 return err
697}

Callers 1

LoadMethod · 0.85

Calls 7

upValueCountMethod · 0.95
protectedCallMethod · 0.80
checkModeMethod · 0.80
parseMethod · 0.80
undumpMethod · 0.80
newUpValueMethod · 0.80
assertMethod · 0.45

Tested by

no test coverage detected