Skip to content

Commit 39887d9

Browse files
jamesonjleesparkprime
authored andcommitted
pull Local.Binds[].Body out via specialChildren (google#232)
* pull Local.Binds[].Body out via specialChildren * move Local.Body to special from direct
1 parent 95e1c17 commit 39887d9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

parser/context.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func directChildren(node ast.Node) []ast.Node {
6666
case *ast.Slice:
6767
return []ast.Node{node.Target, node.BeginIndex, node.EndIndex, node.Step}
6868
case *ast.Local:
69-
return []ast.Node{node.Body}
69+
return nil
7070
case *ast.LiteralBoolean:
7171
return nil
7272
case *ast.LiteralNull:
@@ -249,7 +249,12 @@ func specialChildren(node ast.Node) []ast.Node {
249249
case *ast.Slice:
250250
return nil
251251
case *ast.Local:
252-
return nil
252+
children := make([]ast.Node, 1, len(node.Binds)+1)
253+
children[0] = node.Body
254+
for _, bind := range node.Binds {
255+
children = append(children, bind.Body)
256+
}
257+
return children
253258
case *ast.LiteralBoolean:
254259
return nil
255260
case *ast.LiteralNull:

0 commit comments

Comments
 (0)