aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-04-18 17:43:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-04-19 10:26:57 +0200
commit2152cfbcb2be527366289e08536f7acce254d3f5 (patch)
tree143587e689fab20996af08790fffa66d66a3f9c4 /pkg/compiler
parent815daeab0fe9e740284119987e2921c980368d9d (diff)
all: fix liner errors
pkg/compiler/compiler.go:182: line is 125 characters func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) (res map[*attrDesc]uint64) { sys/targets/common.go:47:21: unnecessary conversion makeMmap(^uint64(target.PageSize)+1, target.PageSize, 0), ^ sys/targets/common.go:61: File is not `gofmt`-ed with `-s` &prog.Call{ sys/windows/init.go:35: File is not `gofmt`-ed with `-s` &prog.Call{
Diffstat (limited to 'pkg/compiler')
-rw-r--r--pkg/compiler/compiler.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/pkg/compiler/compiler.go b/pkg/compiler/compiler.go
index 5c5df9f04..a9146305b 100644
--- a/pkg/compiler/compiler.go
+++ b/pkg/compiler/compiler.go
@@ -179,37 +179,37 @@ func (comp *compiler) structIsVarlen(name string) bool {
return varlen
}
-func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) (res map[*attrDesc]uint64) {
+func (comp *compiler) parseAttrs(descs map[string]*attrDesc, parent ast.Node, attrs []*ast.Type) map[*attrDesc]uint64 {
_, parentType, parentName := parent.Info()
- res = make(map[*attrDesc]uint64)
+ res := make(map[*attrDesc]uint64)
for _, attr := range attrs {
if unexpected, _, ok := checkTypeKind(attr, kindIdent); !ok {
comp.error(attr.Pos, "unexpected %v, expect attribute", unexpected)
- return
+ return res
}
if len(attr.Colon) != 0 {
comp.error(attr.Colon[0].Pos, "unexpected ':'")
- return
+ return res
}
desc := descs[attr.Ident]
if desc == nil {
comp.error(attr.Pos, "unknown %v %v attribute %v", parentType, parentName, attr.Ident)
- return
+ return res
}
if _, ok := res[desc]; ok {
comp.error(attr.Pos, "duplicate %v %v attribute %v", parentType, parentName, attr.Ident)
- return
+ return res
}
val := uint64(1)
if desc.HasArg {
val = comp.parseAttrArg(attr)
} else if len(attr.Args) != 0 {
comp.error(attr.Pos, "%v attribute has args", attr.Ident)
- return
+ return res
}
res[desc] = val
}
- return
+ return res
}
func (comp *compiler) parseAttrArg(attr *ast.Type) uint64 {