Remove the unused 'parent' param from the function newTerm().

This commit is contained in:
Celestino Amoroso 2024-05-11 06:41:06 +02:00
parent 775751c67b
commit 0a9543543d
3 changed files with 3 additions and 4 deletions

2
ast.go
View File

@ -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())

View File

@ -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 {

View File

@ -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