Cleaned up linter warnings

This commit is contained in:
Eduard Urbach 2024-06-27 20:54:07 +02:00
parent c67cb81830
commit b6947dab18
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 29 additions and 28 deletions

View file

@ -102,14 +102,15 @@ func TestEachLeaf(t *testing.T) {
expr := expression.Parse(tokens)
leaves := []string{}
expr.EachLeaf(func(leaf *expression.Expression) error {
err := expr.EachLeaf(func(leaf *expression.Expression) error {
leaves = append(leaves, leaf.Token.Text())
return nil
})
assert.Nil(t, err)
assert.DeepEqual(t, leaves, []string{"1", "2", "3", "4", "5", "6", "7", "8"})
err := expr.EachLeaf(func(leaf *expression.Expression) error {
err = expr.EachLeaf(func(leaf *expression.Expression) error {
return fmt.Errorf("error")
})

View file

@ -4,8 +4,8 @@ import (
"git.akyoto.dev/cli/q/src/build/token"
)
// List generates a list of expressions from comma separated parameters.
func List(tokens token.List) []*Expression {
// NewList generates a list of expressions from comma separated parameters.
func NewList(tokens token.List) []*Expression {
var list []*Expression
EachParameter(tokens, func(parameter token.List) error {

View file

@ -38,7 +38,7 @@ func Parse(tokens token.List) *Expression {
isFunctionCall := isComplete(cursor)
if isFunctionCall {
parameters := List(tokens[groupPosition:i])
parameters := NewList(tokens[groupPosition:i])
node := New()
node.Token.Kind = token.Operator