fix: staticcheck and deadcode findings repo-wide, modernize counting loops

This commit is contained in:
2026-08-29 15:25:15 +02:00
parent 9a34733615
commit eacf33d0f7
33 changed files with 88 additions and 250 deletions
+6 -9
View File
@@ -210,18 +210,17 @@ func (p *state) parseText(line []token.Token) {
rest = rest[1:]
}
// Frame: $number ; optional args: -number.
// Frame: $number ; optional args: -number. Whatever remains after the
// header is the body and is parsed by the caller.
if len(rest) > 0 && rest[0].Kind == token.Dollar {
text.Frame = parseOperand(rest[:2]) // "$" "number"
rest = rest[2:]
if len(rest) >= 2 && rest[0].Kind == token.Minus && rest[1].Kind == token.Number {
if len(rest) >= 4 && rest[2].Kind == token.Minus && rest[3].Kind == token.Number {
text.Args = &ast.Operand{
Kind: ast.OpImmediate,
Imm: ast.Immediate{Val: parseInt(rest[1].Text), HasVal: true},
Raw: "-" + rest[1].Text,
Pos: rest[0].Pos,
Imm: ast.Immediate{Val: parseInt(rest[3].Text), HasVal: true},
Raw: "-" + rest[3].Text,
Pos: rest[2].Pos,
}
rest = rest[2:]
}
}
@@ -387,10 +386,8 @@ func parseImmediate(g []token.Token) ast.Immediate {
} else {
imm.Float = text
}
i++
} else if i < len(g) && (g[i].Kind == token.String || g[i].Kind == token.Rune) {
imm.Str = g[i].Text
i++
}
return imm
}