mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: cleanup gdata slightly
In sinit.go, gdata can already handle strings and complex, so no reason to handle them separately. In obj.go, inline gdatastring and gdatacomplex into gdata, since it's the only caller. Allows extracting out the common Linksym calls. Passes toolstash -cmp. Change-Id: I3cb18d9b4206a8a269c36e0d30a345d8e6caba1f Reviewed-on: https://go-review.googlesource.com/31498 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
213ee3d20e
commit
a2f77e9ef8
2 changed files with 24 additions and 57 deletions
|
|
@ -1409,32 +1409,11 @@ func genAsInitNoCheck(n *Node, reportOnly bool) bool {
|
|||
return true
|
||||
|
||||
case OLITERAL:
|
||||
break
|
||||
}
|
||||
|
||||
switch nr.Type.Etype {
|
||||
default:
|
||||
return false
|
||||
|
||||
case TBOOL, TINT8, TUINT8, TINT16, TUINT16,
|
||||
TINT32, TUINT32, TINT64, TUINT64,
|
||||
TINT, TUINT, TUINTPTR, TUNSAFEPTR,
|
||||
TPTR32, TPTR64,
|
||||
TFLOAT32, TFLOAT64:
|
||||
if !reportOnly {
|
||||
gdata(&nam, nr, int(nr.Type.Width))
|
||||
}
|
||||
|
||||
case TCOMPLEX64, TCOMPLEX128:
|
||||
if !reportOnly {
|
||||
gdatacomplex(&nam, nr.Val().U.(*Mpcplx))
|
||||
}
|
||||
|
||||
case TSTRING:
|
||||
if !reportOnly {
|
||||
gdatastring(&nam, nr.Val().U.(string))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue