From b414e5491c58bab824d0a6bb9fd94e17b2a9659a Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Fri, 1 Feb 2019 14:36:49 +0800 Subject: core: vm: sqlvm: introduce interfaces for AST nodes In order to make our AST easier and safer to use, all declarations with empty interface type are now removed. This changes also makes it possible to traverse the AST without using reflection or understanding what each type means because all AST nodes have at least one common interface. --- core/vm/sqlvm/cmd/ast-printer/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/vm/sqlvm/cmd') diff --git a/core/vm/sqlvm/cmd/ast-printer/main.go b/core/vm/sqlvm/cmd/ast-printer/main.go index 6965a1d4e..86a742909 100644 --- a/core/vm/sqlvm/cmd/ast-printer/main.go +++ b/core/vm/sqlvm/cmd/ast-printer/main.go @@ -17,9 +17,9 @@ func main() { n, err := parser.Parse([]byte(flag.Arg(0))) fmt.Printf("detail: %t\n", detail) - if err == nil { - ast.PrintAST(os.Stdout, n, " ", detail) - } else { - fmt.Printf("err:\n%+v\n", err) + if err != nil { + fmt.Fprintf(os.Stderr, "err:\n%+v\n", err) + os.Exit(1) } + ast.PrintAST(os.Stdout, n, " ", detail) } -- cgit v1.2.3