diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-02-21 16:00:23 +0800 |
---|---|---|
committer | lantw44 <lantw44@gmail.com> | 2019-02-25 16:14:12 +0800 |
commit | 8fbd7c39a3685bb8acb466f1cd797c9324e09fc2 (patch) | |
tree | 4c28879387f32dbca9a325523b67c733e8370650 | |
parent | 53ccf03c56a7723f8b1681c6b43272213ee8dbd5 (diff) | |
download | dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar.gz dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar.bz2 dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar.lz dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar.xz dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.tar.zst dexon-8fbd7c39a3685bb8acb466f1cd797c9324e09fc2.zip |
core: vm: sqlvm: ast: remove pointer indicator in printer output
Since our 'Node' interface includes methods which must be implemented
with pointer receivers, all AST nodes are now referenced with pointers
and the '*' pointer indicator is no longer useful.
-rw-r--r-- | core/vm/sqlvm/ast/printer.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/vm/sqlvm/ast/printer.go b/core/vm/sqlvm/ast/printer.go index 56cfd07b9..e9b289411 100644 --- a/core/vm/sqlvm/ast/printer.go +++ b/core/vm/sqlvm/ast/printer.go @@ -44,18 +44,17 @@ func printAST(w io.Writer, n interface{}, depth int, base string, detail bool) { } typeOf := reflect.TypeOf(n) valueOf := reflect.ValueOf(n) - name := "" - if typeOf.Kind() == reflect.Ptr { + kind := typeOf.Kind() + if kind == reflect.Ptr { if valueOf.IsNil() { fmt.Fprintf(w, "%snil\n", indent) return } - name = "*" valueOf = valueOf.Elem() typeOf = typeOf.Elem() + kind = typeOf.Kind() } - kind := typeOf.Kind() - name = name + typeOf.Name() + name := typeOf.Name() if op, ok := n.(UnaryOperator); ok { fmt.Fprintf(w, "%s%s:\n", indent, name) |