MCPcopy
hub / github.com/google/go-jsonnet / cloneNodeBase

Function cloneNodeBase

ast/clone.go:56–63  ·  view source on GitHub ↗

Updates the NodeBase fields of astPtr to point to deep clones.

(astPtr Node)

Source from the content-addressed store, hash-verified

54
55// Updates the NodeBase fields of astPtr to point to deep clones.
56func cloneNodeBase(astPtr Node) {
57 if astPtr.Context() != nil {
58 newContext := new(string)
59 *newContext = *astPtr.Context()
60 astPtr.SetContext(newContext)
61 }
62 astPtr.SetFreeVariables(append(make(Identifiers, 0), astPtr.FreeVariables()...))
63}
64
65func cloneCommaSeparatedExprs(list []CommaSeparatedExpr) []CommaSeparatedExpr {
66 r := append(make([]CommaSeparatedExpr, 0), list...)

Callers 1

cloneFunction · 0.85

Calls 4

ContextMethod · 0.65
SetContextMethod · 0.65
SetFreeVariablesMethod · 0.65
FreeVariablesMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…