// https://github.com/google/skylark/blob/master/doc/spec.md#list·pop
970222
func list_pop(fnname string, recv Value, args Tuple, kwargs []Tuple) (Value, error) {
	list := recv.(*List)
	index := list.Len() - 1
	if err := UnpackPositionalArgs(fnname, args, kwargs, 0, &index); err != nil {
		return nil, err
	}
	if index < 0 || index >= list.Len() {
		return nil, fmt.Errorf("pop: index %d is out of range [0:%d]", index, list.Len())
	}
	if err := list.checkMutable("pop from", true); err != nil {
		return nil, err
	}
	res := list.elems[index]
	list.elems = append(list.elems[:index], list.elems[index+1:]...)
	return res, nil
}
205132
func (d *Context) PopN(count int) {
	if d.GetTop() < count || count < 1 {
		return
	}
	C.duk_pop_n(d.duk_context, C.duk_idx_t(count))
}
443217
func (p *PendingEvaluations) Pop() interface{} {
	n := len(*p)
	e := (*p)[n-1]
	(*p)[n-1] = nil
	*p = (*p)[:n-1]
	return e
}
1157416
func (s *builderStack) Pop() {
	l := len(s.stack)
	if l > 0 {
		s.stack = s.stack[:l-1]
	}
}
639305
func (pq *waitForPriorityQueue) Pop() interface{} {
	n := len(*pq)
	item := (*pq)[n-1]
	item.index = -1
	*pq = (*pq)[0:(n - 1)]
	return item
}
1225727
func (dc *Context) Pop() {
	before := *dc
	s := dc.stack
	x, s := s[len(s)-1], s[:len(s)-1]
	*dc = *x
	dc.mask = before.mask
	dc.strokePath = before.strokePath
	dc.fillPath = before.fillPath
	dc.start = before.start
	dc.current = before.current
	dc.hasCurrent = before.hasCurrent
}
913191
func (t *TxStructure) RPop(key []byte) ([]byte, error) {
	return t.listPop(key, false)
}
637061
func (d *decoder) popAllVs() {
	var nonEmpty [][]reflect.Value
	for i := range d.vs {
		d.vs[i] = d.vs[i][:len(d.vs[i])-1]
		if len(d.vs[i]) > 0 {
			nonEmpty = append(nonEmpty, d.vs[i])
		}
	}
	d.vs = nonEmpty
}
459232
func (c *configuration) pop() head {
	retVal := c.stack[len(c.stack)-1]
	c.stack = c.stack[0 : len(c.stack)-1]
	return retVal
}
655886
func (ph *peerHeap) Pop() interface{} {
	lastIdx := len(ph.peers) - 1
	last := ph.peers[lastIdx]
	ph.peers = ph.peers[:lastIdx]
	return last
}
915591
func dict_popitem(fnname string, recv_ Value, args Tuple, kwargs []Tuple) (Value, error) {
	if err := UnpackPositionalArgs(fnname, args, kwargs, 0); err != nil {
		return nil, err
	}
	recv := recv_.(*Dict)
	k, ok := recv.ht.first()
	if !ok {
		return nil, fmt.Errorf("popitem: empty dict")
	}
	v, _, err := recv.Delete(k)
	if err != nil {
		return nil, err // dict is frozen
	}
	return Tuple{k, v}, nil
}
1194466
func (s *exprStack) pop() Expression {
	if s.len() == 0 {
		return nil
	}
	lastIdx := s.len() - 1
	expr := s.stack[lastIdx]
	s.stack = s.stack[:lastIdx]
	return expr
}
23653
func popSlice(ctx *duktape.Context) []byte {
	blob := common.CopyBytes(makeSlice(ctx.GetBuffer(-1)))
	ctx.Pop()
	return blob
}
439751
func (h *Strings) PopAll() []string {
	for n := h.Len(); n > 1; n-- {
		if h.less == nil {
			PopToLastF(n, h.list.Less, h.list.Swap)
		} else {
			PopToLastF(n, h.less, h.list.Swap)
		}
	}
	res := h.list
	h.list = nil
	return res
}
914335
func (self *Stack) Pop() Token {
	if len(self.Values) == 0 {
		return Token{}
	}
	token := self.Values[len(self.Values)-1]
	self.Values = self.Values[:len(self.Values)-1]
	return token
}
1162269
func (h *Float64s) Pop() float64 {
	if h.less == nil {
		PopToLastF(len(h.list), h.list.Less, h.list.Swap)
	} else {
		PopToLastF(len(h.list), h.less, h.list.Swap)
	}

	res := h.list[len(h.list)-1]
	h.list = h.list[:len(h.list)-1]

	return res
}
521156
func (t *Tree) popVars(n int) {
	t.vars = t.vars[:n]
}