cmd/compile: eliminate NumFields wrapper functions
Change-Id: I3c6035559288cfdc33857216f50241b81932c8a4
Reviewed-on: https://go-review.googlesource.com/20811
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 3b36457..e0e05c7 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -1742,7 +1742,7 @@
}
if i < nl.Len() || r != nil {
- Yyerror("ascompatet: assignment count mismatch: %d = %d", nl.Len(), structcount(nr))
+ Yyerror("ascompatet: assignment count mismatch: %d = %d", nl.Len(), nr.NumFields())
}
if ullmanOverflow {
@@ -3225,7 +3225,7 @@
}
}
- if t.Etype == TSTRUCT && countfield(t) <= 4 {
+ if t.Etype == TSTRUCT && t.NumFields() <= 4 {
// Struct of four or fewer fields.
// Inline comparisons.
var li *Node
@@ -3771,16 +3771,16 @@
//
// TODO(crawshaw): improve precision of match by working out
// how to check the method name.
- if n := countfield(t.Params()); n != 1 {
+ if n := t.Params().NumFields(); n != 1 {
return
}
- if n := countfield(t.Results()); n != 1 && n != 2 {
+ if n := t.Results().NumFields(); n != 1 && n != 2 {
return
}
p0 := t.Params().Field(0)
res0 := t.Results().Field(0)
var res1 *Field
- if countfield(t.Results()) == 2 {
+ if t.Results().NumFields() == 2 {
res1 = t.Results().Field(1)
}