mirror of
https://github.com/golang/go
synced 2024-11-24 16:30:17 -07:00
cmd/compile: change defaultlit2's force param to bool
Change-Id: I5546c4e8092ef61648cdae9c04288bb7d6f32476 Reviewed-on: https://go-review.googlesource.com/20084 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
33c0ef2de3
commit
ac006ad103
@ -1349,7 +1349,7 @@ num:
|
||||
// if they're both ideal going in they better
|
||||
// get the same type going out.
|
||||
// force means must assign concrete (non-ideal) type.
|
||||
func defaultlit2(lp **Node, rp **Node, force int) {
|
||||
func defaultlit2(lp **Node, rp **Node, force bool) {
|
||||
l := *lp
|
||||
r := *rp
|
||||
if l.Type == nil || r.Type == nil {
|
||||
@ -1365,9 +1365,10 @@ func defaultlit2(lp **Node, rp **Node, force int) {
|
||||
return
|
||||
}
|
||||
|
||||
if force == 0 {
|
||||
if !force {
|
||||
return
|
||||
}
|
||||
|
||||
if l.Type.Etype == TBOOL {
|
||||
Convlit(lp, Types[TBOOL])
|
||||
Convlit(rp, Types[TBOOL])
|
||||
|
@ -567,7 +567,7 @@ OpSwitch:
|
||||
}
|
||||
|
||||
// ideal mixed with non-ideal
|
||||
defaultlit2(&l, &r, 0)
|
||||
defaultlit2(&l, &r, false)
|
||||
|
||||
n.Left = l
|
||||
n.Right = r
|
||||
@ -640,7 +640,7 @@ OpSwitch:
|
||||
}
|
||||
|
||||
if t.Etype != TIDEAL && !Eqtype(l.Type, r.Type) {
|
||||
defaultlit2(&l, &r, 1)
|
||||
defaultlit2(&l, &r, true)
|
||||
if n.Op == OASOP && n.Implicit {
|
||||
Yyerror("invalid operation: %v (non-numeric type %v)", n, l.Type)
|
||||
n.Type = nil
|
||||
@ -698,7 +698,7 @@ OpSwitch:
|
||||
evconst(n)
|
||||
t = idealbool
|
||||
if n.Op != OLITERAL {
|
||||
defaultlit2(&l, &r, 1)
|
||||
defaultlit2(&l, &r, true)
|
||||
n.Left = l
|
||||
n.Right = r
|
||||
}
|
||||
@ -1484,7 +1484,7 @@ OpSwitch:
|
||||
n.Type = nil
|
||||
return
|
||||
}
|
||||
defaultlit2(&l, &r, 0)
|
||||
defaultlit2(&l, &r, false)
|
||||
if l.Type == nil || r.Type == nil {
|
||||
n.Type = nil
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user