From 0a9543543d36c68e3732a40341bbd1ca50fa8a4f Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Sat, 11 May 2024 06:41:06 +0200 Subject: [PATCH] Remove the unused 'parent' param from the function newTerm(). --- ast.go | 2 +- parser.go | 2 +- term-constuctor-registry.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ast.go b/ast.go index 3030742..3ba7979 100644 --- a/ast.go +++ b/ast.go @@ -60,7 +60,7 @@ func (self *ast) addToken(tk *Token) (err error) { } func (self *ast) addToken2(tk *Token) (t *term, err error) { - if t = newTerm(tk, nil); t != nil { + if t = newTerm(tk); t != nil { err = self.addTerm(t) } else { err = tk.Errorf("unexpected token %q", tk.String()) diff --git a/parser.go b/parser.go index 0fa42aa..b22c9a8 100644 --- a/parser.go +++ b/parser.go @@ -119,7 +119,7 @@ func (self *parser) parseFuncDef(scanner *scanner) (tree *term, err error) { for lastSym != SymClosedRound && lastSym != SymEos { tk = scanner.Next() if tk.IsSymbol(SymIdentifier) { - param := newTerm(tk, nil) + param := newTerm(tk) args = append(args, param) tk = scanner.Next() } else if itemExpected { diff --git a/term-constuctor-registry.go b/term-constuctor-registry.go index 1474dcb..9479b79 100644 --- a/term-constuctor-registry.go +++ b/term-constuctor-registry.go @@ -17,11 +17,10 @@ func registerTermConstructor(sym Symbol, constructor termContructor) { constructorRegistry[sym] = constructor } -func newTerm(tk *Token, parent *term) (inst *term) { +func newTerm(tk *Token) (inst *term) { if constructorRegistry != nil { if construct, exists := constructorRegistry[tk.Sym]; exists { inst = construct(tk) - inst.setParent(parent) } } return