MCPcopy Create free account
hub / github.com/aws-cloudformation/rain / Clone

Function Clone

internal/node/node.go:29–54  ·  view source on GitHub ↗

Clone returns a copy of the provided node

(node *yaml.Node)

Source from the content-addressed store, hash-verified

27
28// Clone returns a copy of the provided node
29func Clone(node *yaml.Node) *yaml.Node {
30 if node == nil {
31 return nil
32 }
33
34 out := &yaml.Node{
35 Kind: node.Kind,
36 Style: node.Style,
37 Tag: node.Tag,
38 Value: node.Value,
39 Anchor: node.Anchor,
40 Alias: Clone(node.Alias),
41 Content: make([]*yaml.Node, len(node.Content)),
42 HeadComment: node.HeadComment,
43 LineComment: node.LineComment,
44 FootComment: node.FootComment,
45 Line: node.Line,
46 Column: node.Column,
47 }
48
49 for i, child := range node.Content {
50 out.Content[i] = Clone(child)
51 }
52
53 return out
54}
55
56// Returns the parent node of node, paired with its name if it's a map pair.
57// If it is not a map pair, only NodePair.Value is not nil.

Callers 15

FnInvokeMethod · 0.92
processMapsFunction · 0.92
replaceTemplateConstantsFunction · 0.92
ProcessOverridesMethod · 0.92
cloneAndReplacePropsFunction · 0.92
addScalarAttributeFunction · 0.92
processModuleFunction · 0.92
ProcessResourcesMethod · 0.92
ProcessConditionsMethod · 0.92
ProcessFnIfMethod · 0.92
includeS3ObjectFunction · 0.92
NormalizeNodeFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected