cmd/compile: consistently use strlit to access constants string values

Passes toolstash-check.

Change-Id: Ieaef20b7649787727b69469f93ffc942022bc079
Reviewed-on: https://go-review.googlesource.com/c/go/+/195198
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2019-09-14 01:29:19 +07:00 committed by Daniel Martí
parent 142c002ee7
commit 75da700d0a
7 changed files with 19 additions and 19 deletions

View file

@ -762,7 +762,7 @@ func (p *noder) sum(x syntax.Expr) *Node {
n := p.expr(x)
if Isconst(n, CTSTR) && n.Sym == nil {
nstr = n
chunks = append(chunks, nstr.Val().U.(string))
chunks = append(chunks, strlit(nstr))
}
for i := len(adds) - 1; i >= 0; i-- {
@ -772,12 +772,12 @@ func (p *noder) sum(x syntax.Expr) *Node {
if Isconst(r, CTSTR) && r.Sym == nil {
if nstr != nil {
// Collapse r into nstr instead of adding to n.
chunks = append(chunks, r.Val().U.(string))
chunks = append(chunks, strlit(r))
continue
}
nstr = r
chunks = append(chunks, nstr.Val().U.(string))
chunks = append(chunks, strlit(nstr))
} else {
if len(chunks) > 1 {
nstr.SetVal(Val{U: strings.Join(chunks, "")})