Skip to content

Commit 42cb19e

Browse files
sh0rezsbarzowski
authored andcommitted
feat(parser): export parser.Children (#327)
* feat(parser): export parser.Children As parser was moved to internal/parser, it is not possible to import it into external projects anymore. However, parser.Children() is handy to use in static analysis tools, so it is worth exporting. This does that by adding a stub package `github.com/google/go-jsonnet/parser` that wraps the internal function. Signed-off-by: sh0rez <[email protected]>
1 parent 56da397 commit 42cb19e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

toolutils/BUILD.bazel

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_library")
2+
3+
go_library(
4+
name = "go_default_library",
5+
srcs = ["ast.go"],
6+
importpath = "github.com/google/go-jsonnet/toolutils",
7+
visibility = ["//visibility:public"],
8+
deps = [
9+
"//ast:go_default_library",
10+
"//internal/parser:go_default_library",
11+
],
12+
)

toolutils/ast.go

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Package toolutils includes several utilities handy for use in code analysis tools
2+
package toolutils
3+
4+
import (
5+
"github.com/google/go-jsonnet/ast"
6+
"github.com/google/go-jsonnet/internal/parser"
7+
)
8+
9+
// Children returns all children of a node. It supports ASTs before and after desugaring.
10+
func Children(node ast.Node) []ast.Node {
11+
return parser.Children(node)
12+
}

0 commit comments

Comments
 (0)