aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-03 15:48:26 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-03 15:48:26 +0200
commita630fd8b418650f8df52aead511ec4d27ca48ad2 (patch)
tree0202f7587a306bab366f7d3720ef9b831933e3e0 /pkg
parent9fe5658a1b7320b756d02cf2075dc5c735f86ff4 (diff)
gometalinter: some fixes for unparam
But we still can't enable it as there are more [uninteresting] warnings. Update #538
Diffstat (limited to 'pkg')
-rw-r--r--pkg/compiler/compiler.go6
-rw-r--r--pkg/compiler/consts.go16
2 files changed, 9 insertions, 13 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
index 809de5bd5..f49576561 100644
--- a/pkg/compiler/compiler.go
+++ b/pkg/compiler/compiler.go
@@ -176,7 +176,7 @@ func (comp *compiler) parseUnionAttrs(n *ast.Struct) (varlen bool, size uint64)
}
varlen = true
case "size":
- size = comp.parseSizeAttr(n, attr)
+ size = comp.parseSizeAttr(attr)
default:
comp.error(attr.Pos, "unknown union %v attribute %v",
n.Name.Name, attr.Ident)
@@ -215,7 +215,7 @@ func (comp *compiler) parseStructAttrs(n *ast.Struct) (packed bool, size, align
}
align = a
case attr.Ident == "size":
- size = comp.parseSizeAttr(n, attr)
+ size = comp.parseSizeAttr(attr)
default:
comp.error(attr.Pos, "unknown struct %v attribute %v",
n.Name.Name, attr.Ident)
@@ -224,7 +224,7 @@ func (comp *compiler) parseStructAttrs(n *ast.Struct) (packed bool, size, align
return
}
-func (comp *compiler) parseSizeAttr(n *ast.Struct, attr *ast.Type) uint64 {
+func (comp *compiler) parseSizeAttr(attr *ast.Type) uint64 {
if len(attr.Args) != 1 {
comp.error(attr.Pos, "%v attribute is expected to have 1 argument", attr.Ident)
return sizeUnassigned
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go
index 1b008bd4f..79bf84e70 100644
--- a/pkg/compiler/consts.go
+++ b/pkg/compiler/consts.go
@@ -170,7 +170,7 @@ func (comp *compiler) patchConsts(consts map[string]uint64) {
n := decl.(*ast.IntFlags)
var values []*ast.Int
for _, v := range n.Values {
- if comp.patchIntConst(v.Pos, &v.Value, &v.Ident, consts, nil) {
+ if comp.patchIntConst(&v.Value, &v.Ident, consts, nil) {
values = append(values, v)
}
}
@@ -182,10 +182,9 @@ func (comp *compiler) patchConsts(consts map[string]uint64) {
args []*ast.Type, _ prog.IntTypeCommon) {
for i, arg := range args {
if desc.Args[i].Type.Kind == kindInt {
- comp.patchIntConst(arg.Pos, &arg.Value,
- &arg.Ident, consts, &missing)
+ comp.patchIntConst(&arg.Value, &arg.Ident, consts, &missing)
if arg.HasColon {
- comp.patchIntConst(arg.Pos2, &arg.Value2,
+ comp.patchIntConst(&arg.Value2,
&arg.Ident2, consts, &missing)
}
}
@@ -193,16 +192,14 @@ func (comp *compiler) patchConsts(consts map[string]uint64) {
})
if n, ok := decl.(*ast.Resource); ok {
for _, v := range n.Values {
- comp.patchIntConst(v.Pos, &v.Value,
- &v.Ident, consts, &missing)
+ comp.patchIntConst(&v.Value, &v.Ident, consts, &missing)
}
}
if n, ok := decl.(*ast.Struct); ok {
for _, attr := range n.Attrs {
if attr.Ident == "size" {
sz := attr.Args[0]
- comp.patchIntConst(sz.Pos, &sz.Value,
- &sz.Ident, consts, &missing)
+ comp.patchIntConst(&sz.Value, &sz.Ident, consts, &missing)
}
}
}
@@ -227,8 +224,7 @@ func (comp *compiler) patchConsts(consts map[string]uint64) {
}
}
-func (comp *compiler) patchIntConst(pos ast.Pos, val *uint64, id *string,
- consts map[string]uint64, missing *string) bool {
+func (comp *compiler) patchIntConst(val *uint64, id *string, consts map[string]uint64, missing *string) bool {
if *id == "" {
return true
}