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

Method growStack

stack.go:469–488  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

467}
468
469func (l *State) growStack(n int) {
470 if len(l.stack) > maxStack { // error after extra size?
471 l.throw(ErrorError)
472 } else {
473 needed := l.top + n + extraStack
474 newSize := 2 * len(l.stack)
475 if newSize > maxStack {
476 newSize = maxStack
477 }
478 if newSize < needed {
479 newSize = needed
480 }
481 if newSize > maxStack { // stack overflow?
482 l.reallocStack(errorStackSize)
483 l.runtimeError("stack overflow")
484 } else {
485 l.reallocStack(newSize)
486 }
487 }
488}

Callers 2

CheckStackMethod · 0.95
checkStackMethod · 0.95

Calls 3

throwMethod · 0.95
reallocStackMethod · 0.95
runtimeErrorMethod · 0.95

Tested by

no test coverage detected