// PushGoFunction push the given function into duktape stack, returns non-negative
// index (relative to stack bottom) of the pushed function
346319
func (d *Context) PushGoFunction(fn func(*Context) int) int {
	funPtr := d.fnIndex.add(fn)
	ctxPtr := contexts.add(d)

	idx := d.PushCFunction((*[0]byte)(C.goFunctionCall), C.DUK_VARARGS)
	d.PushCFunction((*[0]byte)(C.goFinalizeCall), 1)
	d.PushPointer(funPtr)
	d.PutPropString(-2, goFunctionPtrProp)
	d.PushPointer(ctxPtr)
	d.PutPropString(-2, goContextPtrProp)
	d.SetFinalizer(-2)

	d.PushPointer(funPtr)
	d.PutPropString(-2, goFunctionPtrProp)
	d.PushPointer(ctxPtr)
	d.PutPropString(-2, goContextPtrProp)

	return idx
}
406406
func (d *Decoder) pushEOF() {
	// Walk down stack to find Start.
	// It might not be the top, because there might be stkNs
	// entries above it.
	start := d.stk
	for start.kind != stkStart {
		start = start.next
	}
	// The stkNs entries below a start are associated with that
	// element too; skip over them.
	for start.next != nil && start.next.kind == stkNs {
		start = start.next
	}
	s := d.free
	if s != nil {
		d.free = s.next
	} else {
		s = new(stack)
	}
	s.kind = stkEOF
	s.next = start.next
	start.next = s
}
1319646
func (s *RevertStack) Push(revertFunc RevertFunc) {
	if revertFunc != nil {
		s.revertFuncs = append(s.revertFuncs, revertFunc)
	}
}
670442
func (s *Stack) Push(value interface{}) *Stack {
	s.values.PushBack(value)
	return s
}
1353574
func PushLastF(Len int, Less func(i, j int) bool, Swap func(i, j int)) {
	heapUp(Less, Swap, Len-1)
}
549802
func (ms *TransformStack) Push(m mgl64.Mat4) {
	prev := (*ms)[len(*ms)-1]
	(*ms) = append(*ms, prev.Mul4(m))
}
1012412
func (p *Pusher) Push(ctx context.Context) error {
	if p.PushFormat == "" {
		p.PushFormat = expfmt.FmtText
	}

	resps := make(chan (error))
	go func() {
		resps <- p.push(ctx)
	}()

	select {
	case err := <-resps:
		return err
	case <-ctx.Done():
		return ctx.Err()
	}
}
923095
func (l *State) ToGoFunction(index int) Function {
	switch v := l.indexToValue(index).(type) {
	case *goFunction:
		return v.Function
	case *goClosure:
		return v.function
	}
	return nil
}
1166973
func (stack *ErrorStack) Push(err error) bool {
	if err != nil {
		stack.errors = append(stack.errors, err)
		return true
	}
	return false
}
180750
func (q *Queue) Push(object interface{}) error {
	q.Lock()
	defer q.Unlock()

	if q.maxLen == 0 || q.len() < q.maxLen {
		q.queue = append(q.queue, object)
		return nil
	}

	// q.maxLen > 0 && q.len() == q.maxLen

	switch q.mode {
	case modeNormal:
		return ErrQueueOverflowed
	case modeDrop:
		if _, err := q.pop(); err != nil {
			return ErrFailedToDrop(err)
		}
		q.queue = append(q.queue, object)
		return nil
	}
	return nil
}
1020270
func (s *Session) PushToFront(ctx context.Context) error {
	if s.IsFrontend {
		return constants.ErrFrontSessionCantPushToFront
	}
	return s.sendRequestToFront(ctx, constants.SessionPushRoute, true)
}
1111275
func (l *ItemList) PushFront(v Item) *ItemElement {
	l.lazyInit()
	return l.insertValue(v, &l.root)
}
797670
func (c *Cluster) PushImage(opts docker.PushImageOptions, auth docker.AuthConfiguration) error {
	key := imageKey(opts.Name, opts.Tag)
	img, err := c.storage().RetrieveImage(key)
	if err != nil {
		return err
	}
	node, err := c.getNodeByAddr(img.LastNode)
	if err != nil {
		return err
	}
	node.setPersistentClient()
	return wrapError(node, node.PushImage(opts, auth))
}
199902
func (d *Context) PushPointer(p unsafe.Pointer) {
	C.duk_push_pointer(d.duk_context, p)
}
499368
func (ctx *Context) PushGlobalProxy(name string, v interface{}) int {
	ctx.PushGlobalObject()
	obj := ctx.PushProxy(v)
	ctx.PutPropString(-2, name)
	ctx.Pop()

	return obj
}
1136509
func (l *PacketIntervalList) PushFront(v PacketInterval) *PacketIntervalElement {
	l.lazyInit()
	return l.insertValue(v, &l.root)
}
1152843
func (m *Accumulator) PushWithf(fmtstr string, err error, args ...interface{}) {
	if err != nil {
		m.Pushf(fmtstr, append([]interface{}{err}, args...)...)
	}
}