Push pushes the passed callFrame onto the stack. it panics if the stack is full, caller should call IsFull() before invoking this to avoid this.
(v callFrame)
| 284 | // Push pushes the passed callFrame onto the stack. it panics if the stack is full, caller should call IsFull() before |
| 285 | // invoking this to avoid this. |
| 286 | func (cs *autoGrowingCallFrameStack) Push(v callFrame) { |
| 287 | curSeg := cs.segments[cs.segIdx] |
| 288 | if cs.segSp >= FramesPerSegment { |
| 289 | // segment full, push new segment if allowed |
| 290 | if cs.segIdx < segIdx(len(cs.segments)-1) { |
| 291 | curSeg = newCallFrameStackSegment() |
| 292 | cs.segIdx++ |
| 293 | cs.segments[cs.segIdx] = curSeg |
| 294 | cs.segSp = 0 |
| 295 | } else { |
| 296 | panic("lua callstack overflow") |
| 297 | } |
| 298 | } |
| 299 | curSeg.array[cs.segSp] = v |
| 300 | curSeg.array[cs.segSp].Idx = int(cs.segSp) + FramesPerSegment*int(cs.segIdx) |
| 301 | cs.segSp++ |
| 302 | } |
| 303 | |
| 304 | // Sp retrieves the current stack depth, which is the number of frames currently pushed on the stack. |
| 305 | func (cs *autoGrowingCallFrameStack) Sp() int { |
nothing calls this directly
no test coverage detected