Skip to content

Commit 50f6556

Browse files
committed
Remove unused functions found by linter
Removed deprecated functions that were replaced by CallOrSelect: - generateSelector() - replaced by generateCallOrSelect() - generateCall() - replaced by generateCallOrSelect() - normalizeWhitespace() - unused test helper All tests still passing (9 parser + 20 codegen).
1 parent c4717c1 commit 50f6556

2 files changed

Lines changed: 0 additions & 52 deletions

File tree

pkg/codegen/codegen.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -844,45 +844,6 @@ func (g *Generator) generateLiteral(lit *guixast.Literal) ast.Expr {
844844
return ast.NewIdent("nil")
845845
}
846846

847-
// generateSelector generates code for a selector expression
848-
// Example: e.Target.Value
849-
func (g *Generator) generateSelector(sel *guixast.Selector) ast.Expr {
850-
// Start with the base identifier
851-
var result ast.Expr = ast.NewIdent(sel.Base)
852-
853-
// Chain the field selectors
854-
for _, field := range sel.Fields {
855-
result = &ast.SelectorExpr{
856-
X: result,
857-
Sel: ast.NewIdent(field),
858-
}
859-
}
860-
861-
return result
862-
}
863-
864-
// generateCall generates code for a function call or method call
865-
func (g *Generator) generateCall(call *guixast.Call) ast.Expr {
866-
args := make([]ast.Expr, len(call.Args))
867-
for i, arg := range call.Args {
868-
args[i] = g.generateExpr(arg)
869-
}
870-
871-
// Build the function expression from base and fields
872-
var fun ast.Expr = ast.NewIdent(call.Base)
873-
for _, field := range call.Fields {
874-
fun = &ast.SelectorExpr{
875-
X: fun,
876-
Sel: ast.NewIdent(field),
877-
}
878-
}
879-
880-
return &ast.CallExpr{
881-
Fun: fun,
882-
Args: args,
883-
}
884-
}
885-
886847
// generateMakeCall generates code for a make() function call
887848
// Example: make(chan int, 10)
888849
func (g *Generator) generateMakeCall(makeCall *guixast.MakeCall) ast.Expr {

pkg/codegen/codegen_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@ import (
77
"github.com/gaarutyunov/guix/pkg/parser"
88
)
99

10-
// normalizeWhitespace normalizes whitespace in generated code for comparison
11-
func normalizeWhitespace(s string) string {
12-
lines := strings.Split(s, "\n")
13-
var normalized []string
14-
for _, line := range lines {
15-
trimmed := strings.TrimSpace(line)
16-
if trimmed != "" {
17-
normalized = append(normalized, trimmed)
18-
}
19-
}
20-
return strings.Join(normalized, "\n")
21-
}
22-
2310
func TestGenerateSimpleComponent(t *testing.T) {
2411
tests := []struct {
2512
name string

0 commit comments

Comments
 (0)