mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: turn some pointer params into results
These are likely from the time when gc was written in C. There is no need for any of these to be passed pointers, as the previous values are not kept in any way, and the pointers are never nil. Others were left untouched as they fell into one of these useful cases. While at it, also turn some 0/1 integers into booleans. Passes toolstash -cmp on std cmd. Change-Id: Id3a9c9e84ef89536c4dc69a7fdbacd0fd7a76a9b Reviewed-on: https://go-review.googlesource.com/72990 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
f3884680fc
commit
d5960e3043
4 changed files with 28 additions and 35 deletions
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
// range
|
||||
func typecheckrange(n *Node) {
|
||||
var toomany int
|
||||
var toomany bool
|
||||
var why string
|
||||
var t1 *types.Type
|
||||
var t2 *types.Type
|
||||
|
|
@ -50,7 +50,7 @@ func typecheckrange(n *Node) {
|
|||
}
|
||||
n.Type = t
|
||||
|
||||
toomany = 0
|
||||
toomany = false
|
||||
switch t.Etype {
|
||||
default:
|
||||
yyerrorl(n.Pos, "cannot range over %L", n.Right)
|
||||
|
|
@ -73,7 +73,7 @@ func typecheckrange(n *Node) {
|
|||
t1 = t.Elem()
|
||||
t2 = nil
|
||||
if n.List.Len() == 2 {
|
||||
toomany = 1
|
||||
toomany = true
|
||||
}
|
||||
|
||||
case TSTRING:
|
||||
|
|
@ -81,7 +81,7 @@ func typecheckrange(n *Node) {
|
|||
t2 = types.Runetype
|
||||
}
|
||||
|
||||
if n.List.Len() > 2 || toomany != 0 {
|
||||
if n.List.Len() > 2 || toomany {
|
||||
yyerrorl(n.Pos, "too many variables in range")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue