mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: ir.BranchStmt, add ir.EmptyStmt, ir.LabelStmt
These are the first three specific implementations of Node. They are both a bit of a warmup and also working toward removing references to Name from Node types other than the proper named things - ONAME, ONONAME, OTYPE, OLITERAL. (In this case, BranchStmt and LabelStmt.) Passes buildall w/ toolstash -cmp. Change-Id: Ide816b162025ee4c858dd061d7c29ed633fb7baf Reviewed-on: https://go-review.googlesource.com/c/go/+/274091 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
b09dbc6913
commit
be3d8b40b5
3 changed files with 92 additions and 8 deletions
|
|
@ -1702,13 +1702,19 @@ func NodAt(pos src.XPos, op Op, nleft, nright Node) Node {
|
|||
n = &x.n
|
||||
n.SetFunc(&x.f)
|
||||
n.Func().Decl = n
|
||||
case OLABEL, OPACK:
|
||||
case OPACK:
|
||||
var x struct {
|
||||
n node
|
||||
m Name
|
||||
}
|
||||
n = &x.n
|
||||
n.SetName(&x.m)
|
||||
case OEMPTY:
|
||||
return NewEmptyStmt(pos)
|
||||
case OBREAK, OCONTINUE, OFALL, OGOTO:
|
||||
return NewBranchStmt(pos, op, nil)
|
||||
case OLABEL:
|
||||
return NewLabelStmt(pos, nil)
|
||||
default:
|
||||
n = new(node)
|
||||
}
|
||||
|
|
@ -1740,7 +1746,6 @@ var okForNod = [OEND]bool{
|
|||
OASOP: true,
|
||||
OBITNOT: true,
|
||||
OBLOCK: true,
|
||||
OBREAK: true,
|
||||
OBYTES2STR: true,
|
||||
OBYTES2STRTMP: true,
|
||||
OCALL: true,
|
||||
|
|
@ -1757,7 +1762,6 @@ var okForNod = [OEND]bool{
|
|||
OCLOSUREVAR: true,
|
||||
OCOMPLEX: true,
|
||||
OCOMPLIT: true,
|
||||
OCONTINUE: true,
|
||||
OCONV: true,
|
||||
OCONVIFACE: true,
|
||||
OCONVNOP: true,
|
||||
|
|
@ -1779,15 +1783,12 @@ var okForNod = [OEND]bool{
|
|||
ODOTTYPE: true,
|
||||
ODOTTYPE2: true,
|
||||
OEFACE: true,
|
||||
OEMPTY: true,
|
||||
OEQ: true,
|
||||
OFALL: true,
|
||||
OFOR: true,
|
||||
OFORUNTIL: true,
|
||||
OGE: true,
|
||||
OGETG: true,
|
||||
OGO: true,
|
||||
OGOTO: true,
|
||||
OGT: true,
|
||||
OIDATA: true,
|
||||
OIF: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue