mirror of
https://github.com/golang/go.git
synced 2025-11-02 17:50:56 +00:00
[dev.typeparams] cmd/compile: implement generic type switches
Add a new dynamicType node, which is used as a case entry when the type being switched to is generic. Change-Id: Ice77c6f224b8fdd3ff574fdf4a8ea5f6c7ddbe75 Reviewed-on: https://go-review.googlesource.com/c/go/+/339429 Trust: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
57668b84ff
commit
ca3c6985cd
21 changed files with 342 additions and 18 deletions
|
|
@ -700,6 +700,15 @@ func NewDynamicTypeAssertExpr(pos src.XPos, op Op, x, t Node) *DynamicTypeAssert
|
|||
return n
|
||||
}
|
||||
|
||||
func (n *DynamicTypeAssertExpr) SetOp(op Op) {
|
||||
switch op {
|
||||
default:
|
||||
panic(n.no("SetOp " + op.String()))
|
||||
case ODYNAMICDOTTYPE, ODYNAMICDOTTYPE2:
|
||||
n.op = op
|
||||
}
|
||||
}
|
||||
|
||||
// A UnaryExpr is a unary expression Op X,
|
||||
// or Op(X) for a builtin function that does not end up being a call.
|
||||
type UnaryExpr struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue