diff --git a/toolutils/BUILD.bazel b/toolutils/BUILD.bazel new file mode 100644 index 0000000..7c0a6a7 --- /dev/null +++ b/toolutils/BUILD.bazel @@ -0,0 +1,12 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") + +go_library( + name = "go_default_library", + srcs = ["ast.go"], + importpath = "github.com/google/go-jsonnet/toolutils", + visibility = ["//visibility:public"], + deps = [ + "//ast:go_default_library", + "//internal/parser:go_default_library", + ], +) diff --git a/toolutils/ast.go b/toolutils/ast.go new file mode 100644 index 0000000..b791252 --- /dev/null +++ b/toolutils/ast.go @@ -0,0 +1,12 @@ +// Package toolutils includes several utilities handy for use in code analysis tools +package toolutils + +import ( + "github.com/google/go-jsonnet/ast" + "github.com/google/go-jsonnet/internal/parser" +) + +// Children returns all children of a node. It supports ASTs before and after desugaring. +func Children(node ast.Node) []ast.Node { + return parser.Children(node) +}