From 1fb32ebcbcf189032c31e39b7cb5af8e2471ea3a Mon Sep 17 00:00:00 2001 From: zhuliquan Date: Sun, 7 Apr 2024 23:56:57 +0800 Subject: [PATCH] fix: fix bug on nil invoke parenthesis --- ast/node.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ast/node.go b/ast/node.go index dcd79ae5..d659d408 100644 --- a/ast/node.go +++ b/ast/node.go @@ -54,7 +54,9 @@ func (n *base) SetType(t reflect.Type) { // SetParenthesis indicate node is surround by bracket func (n *base) SetParenthesis() { - n.hasParen = true + if n != nil { + n.hasParen = true + } } func (n *base) parenthesis() bool {