diff --git a/ast/stdast.go b/ast/stdast.go deleted file mode 100644 index cfaa71d..0000000 --- a/ast/stdast.go +++ /dev/null @@ -1,8 +0,0 @@ -package ast - -// StdAst is the AST for the standard library. -// -// Its inital value is the Jsonnet null value, such that the standard library is not available -// during evaluation. Set this variable to point at a non-null AST node to make that tree available -// as the standard library. -var StdAst Node = &LiteralNull{} diff --git a/astgen/stdast.go b/astgen/stdast.go index d646816..f1e9e27 100644 --- a/astgen/stdast.go +++ b/astgen/stdast.go @@ -11,9 +11,6 @@ import ( "github.com/google/go-jsonnet/ast" ) -func init() { - ast.StdAst = StdAst -} var p3Var = "$" var p3 = &p3Var var p8Var = "object " diff --git a/c-bindings/c-bindings.go b/c-bindings/c-bindings.go index 759558c..5f7e855 100644 --- a/c-bindings/c-bindings.go +++ b/c-bindings/c-bindings.go @@ -6,8 +6,6 @@ import ( "os" "github.com/google/go-jsonnet" - "github.com/google/go-jsonnet/ast" - "github.com/google/go-jsonnet/astgen" // #cgo CXXFLAGS: -std=c++11 -Wall -I../cpp-jsonnet/include // #include "internal.h" @@ -159,5 +157,4 @@ func jsonnet_tla_code(vmRef *C.struct_JsonnetVm, key, value *C.char) { } func main() { - ast.StdAst = astgen.StdAst } diff --git a/cmd/dumpstdlibast/dumpstdlibast.go b/cmd/dumpstdlibast/dumpstdlibast.go index 3ee5f3a..6627c4f 100644 --- a/cmd/dumpstdlibast/dumpstdlibast.go +++ b/cmd/dumpstdlibast/dumpstdlibast.go @@ -62,7 +62,4 @@ import ( "github.com/google/go-jsonnet/ast" ) -func init() { - ast.StdAst = StdAst -} `[1:] diff --git a/cmd/jsonnet/cmd.go b/cmd/jsonnet/cmd.go index f042cb9..0c6a9d2 100644 --- a/cmd/jsonnet/cmd.go +++ b/cmd/jsonnet/cmd.go @@ -32,8 +32,6 @@ import ( "github.com/fatih/color" "github.com/google/go-jsonnet" - "github.com/google/go-jsonnet/ast" - "github.com/google/go-jsonnet/astgen" ) func nextArg(i *int, args []string) string { @@ -473,7 +471,6 @@ func writeOutputFile(output string, outputFile string, createDirs bool) error { } func main() { - ast.StdAst = astgen.StdAst // https://blog.golang.org/profiling-go-programs var cpuprofile = os.Getenv("JSONNET_CPU_PROFILE") if cpuprofile != "" { diff --git a/interpreter.go b/interpreter.go index c26581a..313d808 100644 --- a/interpreter.go +++ b/interpreter.go @@ -24,6 +24,7 @@ import ( "sort" "github.com/google/go-jsonnet/ast" + "github.com/google/go-jsonnet/astgen" ) // TODO(sbarzowski) use it as a pointer in most places b/c it can sometimes be shared @@ -1119,7 +1120,7 @@ func evaluateStd(i *interpreter) (value, error) { ) evalLoc := ast.MakeLocationRangeMessage("During evaluation of std") evalTrace := TraceElement{loc: &evalLoc} - node := ast.StdAst + node := astgen.StdAst return i.EvalInCleanEnv(evalTrace, &beforeStdEnv, node, false) } diff --git a/jsonnet_test.go b/jsonnet_test.go index 7b5c2fa..5c64558 100644 --- a/jsonnet_test.go +++ b/jsonnet_test.go @@ -4,15 +4,8 @@ import ( "bytes" "testing" "unicode/utf8" - - "github.com/google/go-jsonnet/ast" - "github.com/google/go-jsonnet/astgen" ) -func init() { - ast.StdAst = astgen.StdAst -} - type errorFormattingTest struct { name string input string