MCPcopy Create free account
hub / github.com/z7zmey/php-parser / Walk

Method Walk

node/stmt/n_function.go:60–98  ·  view source on GitHub ↗

Walk traverses nodes Walk is invoked recursively until v.EnterNode returns true

(v walker.Visitor)

Source from the content-addressed store, hash-verified

58// Walk traverses nodes
59// Walk is invoked recursively until v.EnterNode returns true
60func (n *Function) Walk(v walker.Visitor) {
61 if v.EnterNode(n) == false {
62 return
63 }
64
65 if n.FunctionName != nil {
66 v.EnterChildNode("FunctionName", n)
67 n.FunctionName.Walk(v)
68 v.LeaveChildNode("FunctionName", n)
69 }
70
71 if n.Params != nil {
72 v.EnterChildList("Params", n)
73 for _, nn := range n.Params {
74 if nn != nil {
75 nn.Walk(v)
76 }
77 }
78 v.LeaveChildList("Params", n)
79 }
80
81 if n.ReturnType != nil {
82 v.EnterChildNode("ReturnType", n)
83 n.ReturnType.Walk(v)
84 v.LeaveChildNode("ReturnType", n)
85 }
86
87 if n.Stmts != nil {
88 v.EnterChildList("Stmts", n)
89 for _, nn := range n.Stmts {
90 if nn != nil {
91 nn.Walk(v)
92 }
93 }
94 v.LeaveChildList("Stmts", n)
95 }
96
97 v.LeaveNode(n)
98}

Callers

nothing calls this directly

Calls 7

EnterNodeMethod · 0.65
EnterChildNodeMethod · 0.65
WalkMethod · 0.65
LeaveChildNodeMethod · 0.65
EnterChildListMethod · 0.65
LeaveChildListMethod · 0.65
LeaveNodeMethod · 0.65

Tested by

no test coverage detected