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

Function leftRecursive

internal/formatter/jsonnetfmt.go:95–112  ·  view source on GitHub ↗

If left recursive, return the left hand side, else return nullptr.

(expr ast.Node)

Source from the content-addressed store, hash-verified

93
94// If left recursive, return the left hand side, else return nullptr.
95func leftRecursive(expr ast.Node) ast.Node {
96 switch node := expr.(type) {
97 case *ast.Apply:
98 return node.Target
99 case *ast.ApplyBrace:
100 return node.Left
101 case *ast.Binary:
102 return node.Left
103 case *ast.Index:
104 return node.Target
105 case *ast.InSuper:
106 return node.Index
107 case *ast.Slice:
108 return node.Target
109 default:
110 return nil
111 }
112}
113
114// leftRecursiveDeep is the transitive closure of leftRecursive.
115// It only returns nil when called with nil.

Callers 3

unparseMethod · 0.85
VisitMethod · 0.85
leftRecursiveDeepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…