diff options
Diffstat (limited to 'src/cmd/compile/internal/ir/type.go')
-rw-r--r-- | src/cmd/compile/internal/ir/type.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ir/type.go b/src/cmd/compile/internal/ir/type.go index 431468375a..63dd673dcd 100644 --- a/src/cmd/compile/internal/ir/type.go +++ b/src/cmd/compile/internal/ir/type.go @@ -319,3 +319,17 @@ func TypeNodeAt(pos src.XPos, t *types.Type) Ntype { } return newTypeNode(pos, t) } + +// A DynamicType represents the target type in a type switch. +type DynamicType struct { + miniExpr + X Node // a *runtime._type for the targeted type + ITab Node // for type switches from nonempty interfaces to non-interfaces, this is the itab for that pair. +} + +func NewDynamicType(pos src.XPos, x Node) *DynamicType { + n := &DynamicType{X: x} + n.pos = pos + n.op = ODYNAMICTYPE + return n +} |