// pushDownTopNToChild will push a topN to one child of join. The idx stands for join child index. 0 is for left child.
13938
func (p *LogicalJoin) pushDownTopNToChild(topN *LogicalTopN, idx int) LogicalPlan {
	if topN == nil {
		return p.children[idx].pushDownTopN(nil)
	}

	for _, by := range topN.ByItems {
		cols := expression.ExtractColumns(by.Expr)
		for _, col := range cols {
			if p.children[1-idx].Schema().Contains(col) {
				return p.children[idx].pushDownTopN(nil)
			}
		}
	}

	newTopN := LogicalTopN{
		Count:   topN.Count + topN.Offset,
		ByItems: make([]*ByItems, len(topN.ByItems)),
	}.Init(topN.ctx)
	for i := range topN.ByItems {
		newTopN.ByItems[i] = topN.ByItems[i].Clone()
	}
	return p.children[idx].pushDownTopN(newTopN)
}
1265251
func (t *Tab) handleChildNodeInserted(parentNodeId int, node *gcdapi.DOMNode) {
	t.lastNodeChangeTimeVal.Store(time.Now())
	if node == nil {
		return
	}
	t.debugf("child node inserted: id: %d\n", node.NodeId)
	t.addNodes(node)

	parent, _ := t.GetElementByNodeId(parentNodeId)
	// make sure we have the parent before we add children
	if err := parent.WaitForReady(); err == nil {
		parent.addChild(node)
		return
	} else {
		t.debugf("err: %s\n", err)
	}

	t.debugf("unable to add child %d to parent %d because parent is not ready yet", node.NodeId, parentNodeId)
}
529478
func (l *list) PushBack(v interface{}) *element {
	return l.insertValue(v, l.root.prev)
}
1020832
func (c *Frame) FindNextTabStop() bool {
	startTab := c.tabIdx
	c.tabIdx = (c.tabIdx + 1) % len(c.controls)
	for c.controls[c.tabIdx].IsTabSkipped() {
		c.tabIdx = (c.tabIdx + 1) % len(c.controls)
		if c.tabIdx == startTab {
			break
		}
	}
	return c.tabIdx != startTab
}
813994
func (s *Selection) ParentsUntilNodes(nodes ...*html.Node) *Selection {
	return pushStack(s, getParentsNodes(s.Nodes, nil, nodes))
}
985949
func (ctx *Context) PushType(s interface{}) int {
	return ctx.PushGoFunction(func() {
		value := reflect.New(reflect.TypeOf(s))
		ctx.PushProxy(value.Interface())
	})
}
1111275
func (l *ItemList) PushFront(v Item) *ItemElement {
	l.lazyInit()
	return l.insertValue(v, &l.root)
}
556076
func (lt *LogicalTopN) setChild(p LogicalPlan) LogicalPlan {
	// Remove this TopN if its child is a TableDual.
	dual, isDual := p.(*LogicalTableDual)
	if isDual {
		numDualRows := uint64(dual.RowCount)
		if numDualRows < lt.Offset {
			dual.RowCount = 0
			return dual
		}
		dual.RowCount = int(mathutil.MinUint64(numDualRows-lt.Offset, lt.Count))
		return dual
	}

	if lt.isLimit() {
		limit := LogicalLimit{
			Count:  lt.Count,
			Offset: lt.Offset,
		}.Init(lt.ctx)
		limit.SetChildren(p)
		return limit
	}
	// Then lt must be topN.
	lt.SetChildren(p)
	return lt
}
806021
func (s *nodeStack) top() *Node {
	if i := len(*s); i > 0 {
		return (*s)[i-1]
	}
	return nil
}
967780
func (d *domainClient) PushNodeByPathToFrontend(ctx context.Context, args *PushNodeByPathToFrontendArgs) (reply *PushNodeByPathToFrontendReply, err error) {
	reply = new(PushNodeByPathToFrontendReply)
	if args != nil {
		err = rpcc.Invoke(ctx, "DOM.pushNodeByPathToFrontend", args, reply, d.conn)
	} else {
		err = rpcc.Invoke(ctx, "DOM.pushNodeByPathToFrontend", nil, reply, d.conn)
	}
	if err != nil {
		err = &internal.OpError{Domain: "DOM", Op: "PushNodeByPathToFrontend", Err: err}
	}
	return
}
422094
func (iamRes *IAMResourceBuilder) ToPrivilege() sparta.IAMRolePrivilege {
	return sparta.IAMRolePrivilege{
		Actions:  iamRes.builder.apiCalls,
		Resource: gocf.Join("", iamRes.resourceParts...),
	}
}
860008
func pushStack(fromSel *Selection, nodes []*html.Node) *Selection {
	result := &Selection{nodes, fromSel.document, fromSel}
	return result
}
179445
func (d *Context) SetTop(index int) {
	C.duk_set_top(d.duk_context, C.duk_idx_t(index))
}
581059
func (n Nodeset) ToXPathNodeset() (ret C.xmlXPathObjectPtr) {
	ret = C.xmlXPathNewNodeSet(nil)
	for _, node := range n {
		C.xmlXPathNodeSetAdd(ret.nodesetval, (*C.xmlNode)(node.NodePtr()))
	}
	return
}
975303
func (h *HTML) appendChild(child *HTML) {
	h.node.Call("appendChild", child.node)
}
439732
func (s *selection) pushSelection(a atomWithPackages, pkgonly bool) {
	s.projects = append(s.projects, selected{
		a:     a,
		first: !pkgonly,
	})
}
969584
func Push(obj *js.Object, any interface{}) (idx int) {
	return obj.Call("push", any).Int()
}