*: fix all unused warnings

From golangci-lint.
This commit is contained in:
Roman Khimov 2021-05-12 18:53:12 +03:00
parent de5e61588d
commit 92dbb3c4b9
5 changed files with 4 additions and 50 deletions

View file

@ -1521,33 +1521,6 @@ func getJumpForToken(tok token.Token, typ types.Type) (opcode.Opcode, bool) {
return 0, false
}
// getByteArray returns byte array value from constant expr.
// Only literals are supported.
func (c *codegen) getByteArray(expr ast.Expr) []byte {
switch t := expr.(type) {
case *ast.CompositeLit:
if !isByteSlice(c.typeOf(t.Type)) {
return nil
}
buf := make([]byte, len(t.Elts))
for i := 0; i < len(t.Elts); i++ {
t := c.typeAndValueOf(t.Elts[i])
val, _ := constant.Int64Val(t.Value)
buf[i] = byte(val)
}
return buf
case *ast.CallExpr:
if tv := c.typeAndValueOf(t.Args[0]); tv.Value != nil {
val := constant.StringVal(tv.Value)
return []byte(val)
}
return nil
default:
return nil
}
}
func (c *codegen) convertSyscall(f *funcScope, expr *ast.CallExpr) {
for _, arg := range expr.Args[1:] {
ast.Walk(c, arg)