]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rename strlit, Bool, and Int64 *Node accessors
authorAlberto Donizetti <alb.donizetti@gmail.com>
Mon, 12 Oct 2020 13:02:59 +0000 (15:02 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Wed, 14 Oct 2020 08:00:39 +0000 (08:00 +0000)
commite2931612b04e2ea6be337872c6f4a31c7d7dec54
tree05a2d855c3b9cc8dc054102504832fc52c1671c0
parent7c58ef732efd9bf0d0882bb95371ce1909924a75
cmd/compile: rename strlit, Bool, and Int64 *Node accessors

The Node type has shortcuts to access bool and int Values:

  func (n *Node) Int64() int64
    for n.Val().U.(*Mpint).Int64()

  func (n *Node) Bool() bool
    for n.Val().U.(bool)

I was convinced we didn't have one for string literal nodes, until I
noticed that we do, it's just called strlit, it's not a method, and
it's later in the file:

  func strlit(n *Node) string

This change, for consistency:
- Renames strlit to StringVal and makes it a *Node method
- Renames Bool and Int64 to BoolVal and Int64Val
- Moves StringVal near the other two

Change-Id: I18e635384c35eb3a238fd52b1ccd322b1a74d733
Reviewed-on: https://go-review.googlesource.com/c/go/+/261361
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/const.go
src/cmd/compile/internal/gc/esc.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/order.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/swt.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go