]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: first start towards using Ident
authorMatthew Dempsky <mdempsky@google.com>
Tue, 8 Dec 2020 05:56:58 +0000 (21:56 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 9 Dec 2020 17:17:53 +0000 (17:17 +0000)
commit63bc23b5452f6605df3e40ce7ecdd8b0348792af
tree1529e6f676d4cd1d0e9ab2573e1e5afc32a1df66
parenteae8fd519b2cbfa253f2f9068587e0ce765efced
[dev.regabi] cmd/compile: first start towards using Ident

This CL adds Ident, which will eventually replace *Name and *PkgName
within the AST for representing uses of declared names. (Originally, I
intended to call it "IdentExpr", but neither go/ast nor
cmd/compile/internal/syntax include the "Expr" suffix for their
respective types.)

To start, this CL converts two uses of *Name to *Ident: the tag
identifier in a TypeSwitchGuard (which doesn't actually declare a
variable by itself), and the not-yet-known placeholder ONONAME
returned by oldname to stand-in for identifiers that might be declared
later in the package.

The TypeSwitchGuard's Name's Used flag was previously used for
detecting whether none of the per-clause variables were used. To avoid
bloating all Idents for this rare use, a "Used" bool is added to
TypeSwitchGuard instead. Eventually it could maybe be packed into
miniNode.bits, but for now this is good enough.

Passes buildall w/ toolstash -cmp.

Change-Id: I393284d86757cbbebd26e1320c7354e2bdcb30b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/276113
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/iimport.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/ir/mknode.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/node.go
src/cmd/compile/internal/ir/node_gen.go
src/cmd/compile/internal/ir/stmt.go