github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ir/copy.go (about)

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ir
     6  
     7  import (
     8  	"github.com/shogo82148/std/cmd/internal/src"
     9  )
    10  
    11  // Copy returns a shallow copy of n.
    12  func Copy(n Node) Node
    13  
    14  // DeepCopy returns a “deep” copy of n, with its entire structure copied
    15  // (except for shared nodes like ONAME, ONONAME, OLITERAL, and OTYPE).
    16  // If pos.IsKnown(), it sets the source position of newly allocated Nodes to pos.
    17  func DeepCopy(pos src.XPos, n Node) Node
    18  
    19  // DeepCopyList returns a list of deep copies (using DeepCopy) of the nodes in list.
    20  func DeepCopyList(pos src.XPos, list []Node) []Node