// WrapChild implements the Node interface for autogitRootNode.
775768
func (arn autogitRootNode) WrapChild(child libkbfs.Node) libkbfs.Node {
	child = arn.Node.WrapChild(child)
	repo := normalizeRepoName(child.GetBasename())
	return &repoDirNode{
		Node:      child,
		am:        arn.am,
		gitRootFS: arn.fs,
		repo:      repo,
		subdir:    "",
		branch:    "",
	}
}
118129
func wrap(cfg datapath.EndpointConfiguration, stats *SpanStat) *templateCfg {
	if stats == nil {
		stats = &SpanStat{}
	}
	return &templateCfg{
		EndpointConfiguration: cfg,
		stats:                 stats,
	}
}
823885
func (a *RtAttr) AddChild(attr NetlinkRequestData) {
	a.children = append(a.children, attr)
}
125481
func (e *Element) addChildren(childNodes []*gcdapi.DOMNode) {
	for _, child := range childNodes {
		if child != nil {
			e.addChild(child)
		}
	}
}
779883
func decodeChild(data []byte) (noder.Noder, error) {
	clean := bytes.TrimSpace(data)
	if len(data) < 3 {
		return nil, fmt.Errorf("element too short: %s", clean)
	}

	fileNameEnd := bytes.IndexRune(data, fileStartMark)
	dirNameEnd := bytes.IndexRune(data, dirStartMark)
	switch {
	case fileNameEnd == -1 && dirNameEnd == -1:
		return nil, fmt.Errorf(
			"malformed child, no file or dir start mark found")
	case fileNameEnd == -1:
		return decodeDir(clean, nonRoot)
	case dirNameEnd == -1:
		return decodeFile(clean)
	case dirNameEnd < fileNameEnd:
		return decodeDir(clean, nonRoot)
	case dirNameEnd > fileNameEnd:
		return decodeFile(clean)
	}

	return nil, fmt.Errorf("unreachable")
}
66083
func (n *TreeNode) Child(k Value) *TreeNode {
	switch k.(type) {
	case String, Var:
		return n.Children[k]
	}
	return nil
}
2653
func Wrap(path string, cfg Configuration) Wrapper {
	w := &wrapper{
		cfg:  cfg,
		path: path,
		mut:  sync.NewMutex(),
	}
	return w
}
1008129
func (kcb KeyConditionBuilder) buildChildNodes() ([]exprNode, error) {
	childNodes := make([]exprNode, 0, len(kcb.keyConditionList)+len(kcb.operandList))
	for _, keyCondition := range kcb.keyConditionList {
		node, err := keyCondition.buildTree()
		if err != nil {
			return []exprNode{}, err
		}
		childNodes = append(childNodes, node)
	}
	for _, operand := range kcb.operandList {
		ope, err := operand.BuildOperand()
		if err != nil {
			return []exprNode{}, err
		}
		childNodes = append(childNodes, ope.exprNode)
	}

	return childNodes, nil
}
889725
func (eBase *elementBase) AppendChild(child element) {
	switch c := child.(type) {
	case *mixinInvocation:
		eBase.mixins = append(eBase.mixins, c)
	case *declaration:
		eBase.decs = append(eBase.decs, c)
	case *selector:
		eBase.sels = append(eBase.sels, c)
	}
}
124657
func (woc *wfOperationCtx) addChildNode(parent string, child string) {
	parentID := woc.wf.NodeID(parent)
	childID := woc.wf.NodeID(child)
	node, ok := woc.wf.Status.Nodes[parentID]
	if !ok {
		panic(fmt.Sprintf("parent node %s not initialized", parent))
	}
	for _, nodeID := range node.Children {
		if childID == nodeID {
			// already exists
			return
		}
	}
	node.Children = append(node.Children, childID)
	woc.wf.Status.Nodes[parentID] = node
	woc.updated = true
}
1201162
func (e *tagElement) appendChild(child element) {
	e.children = append(e.children, child)
}
750008
func (n *XMLNode) AddChild(child *XMLNode) {
	child.parent = n
	if _, ok := n.Children[child.Name.Local]; !ok {
		n.Children[child.Name.Local] = []*XMLNode{}
	}
	n.Children[child.Name.Local] = append(n.Children[child.Name.Local], child)
}
289088
func RemoveChild(o *js.Object, co ...*js.Object) {
	for _, onode := range co {
		o.Get("parentNode").Call("removeChild", onode)
	}
}
359219
func (c *ConfigLocal) RootNodeWrappers() []func(Node) Node {
	c.lock.RLock()
	defer c.lock.RUnlock()
	return c.rootNodeWrappers[:]
}
576893
func (node *Node) AddChild(child *Node, startLine, endLine int) {
	child.lines(startLine, endLine)
	if node.StartLine < 0 {
		node.StartLine = startLine
	}
	node.endLine = endLine
	node.Children = append(node.Children, child)
}
303459
func (s *Selection) WrapAllHtml(html string) *Selection {
	return s.wrapAllNodes(parseHtml(html)...)
}
369351
func (n *node) makeChild(path string, params map[string]uint16, re *regexp.Regexp, handler http.Handler, isRoot bool) {
	defer n.sortChildren()
NodesLoop:
	for _, child := range n.children {
		minlen := len(child.s)
		if len(path) < minlen {
			minlen = len(path)
		}
		for i := 0; i < minlen; i++ {
			if child.s[i] == path[i] {
				continue
			}
			if i == 0 { // No match from the first byte: see next same-level node.
				continue NodesLoop
			}
			// Difference in the middle of a node: split current node to make subnode and transfer handler to it.
			*child = node{
				s: child.s[:i],
				children: []*node{
					{s: child.s[i:], params: child.params, re: child.re, children: child.children, handler: child.handler},
					{s: path[i:], params: params, re: re, handler: handler},
				},
			}
			// BUG(arthurwhite): If the client has no route for "/" and this split occurs on the first level because of the 2nd byte (just after the leading "/"), the isRoot flag of the parent node ("/") is false.
			// It's not a problem because it has no handler and will never match a request, but it's not clean.
			// A first solution would be to let makeChild know the current level in tree, but... All that for this?
			return
		}
		if len(path) < len(child.s) { // s fully matched first part of n.s: split node.
			*child = node{
				s:      child.s[:len(path)],
				params: params,
				re:     re,
				children: []*node{
					{s: child.s[len(path):], params: child.params, re: child.re, children: child.children, handler: child.handler},
				},
				handler: handler,
				isRoot:  isRoot,
			}
		} else if len(path) > len(child.s) { // n.s fully matched first part of s: see subnodes for the rest.
			child.makeChild(path[len(child.s):], params, re, handler, false)
		} else { // s == n.s and no rest: node has no handler or route is duplicated.
			if handler == nil { // No handler provided (must be a non-ending path parameter): don't overwrite.
				return
			}
			if child.handler != nil { // Handler provided but child.handler already set: it's a parameter with another re value, or route is duplicated.
				if re == nil && child.re == nil || re != nil && child.re != nil && re.String() == child.re.String() {
					panic("router: two or more routes have same path")
				}
				continue NodesLoop // It's a parameter with a different regular expression: check next child for "same path" error. Otherwise, node will be appended.
			}
			child.params = params
			child.re = re
			child.handler = handler
			child.isRoot = isRoot
		}
		return
	}
	n.children = append(n.children, &node{s: path, params: params, re: re, handler: handler, isRoot: isRoot}) // Not a single byte match on same-level nodes: append a new one.
}