github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/reflectdata/helpers.go (about) 1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package reflectdata 6 7 import ( 8 "github.com/shogo82148/std/cmd/compile/internal/ir" 9 "github.com/shogo82148/std/cmd/internal/src" 10 ) 11 12 // AppendElemRType asserts that n is an "append" operation, and 13 // returns an expression that yields the *runtime._type value 14 // representing the result slice type's element type. 15 func AppendElemRType(pos src.XPos, n *ir.CallExpr) ir.Node 16 17 // CompareRType asserts that n is a comparison (== or !=) operation 18 // between expressions of interface and non-interface type, and 19 // returns an expression that yields the *runtime._type value 20 // representing the non-interface type. 21 func CompareRType(pos src.XPos, n *ir.BinaryExpr) ir.Node 22 23 // ConvIfaceTypeWord asserts that n is conversion to interface type, 24 // and returns an expression that yields the *runtime._type or 25 // *runtime.itab value necessary for implementing the conversion. 26 // 27 // - *runtime._type for the destination type, for I2I conversions 28 // - *runtime.itab, for T2I conversions 29 // - *runtime._type for the source type, for T2E conversions 30 func ConvIfaceTypeWord(pos src.XPos, n *ir.ConvExpr) ir.Node 31 32 // ConvIfaceSrcRType asserts that n is a conversion from 33 // non-interface type to interface type, and 34 // returns an expression that yields the *runtime._type for copying 35 // the convertee value to the heap. 36 func ConvIfaceSrcRType(pos src.XPos, n *ir.ConvExpr) ir.Node 37 38 // CopyElemRType asserts that n is a "copy" operation, and returns an 39 // expression that yields the *runtime._type value representing the 40 // destination slice type's element type. 41 func CopyElemRType(pos src.XPos, n *ir.BinaryExpr) ir.Node 42 43 // DeleteMapRType asserts that n is a "delete" operation, and returns 44 // an expression that yields the *runtime._type value representing the 45 // map type. 46 func DeleteMapRType(pos src.XPos, n *ir.CallExpr) ir.Node 47 48 // IndexMapRType asserts that n is a map index operation, and returns 49 // an expression that yields the *runtime._type value representing the 50 // map type. 51 func IndexMapRType(pos src.XPos, n *ir.IndexExpr) ir.Node 52 53 // MakeChanRType asserts that n is a "make" operation for a channel 54 // type, and returns an expression that yields the *runtime._type 55 // value representing that channel type. 56 func MakeChanRType(pos src.XPos, n *ir.MakeExpr) ir.Node 57 58 // MakeMapRType asserts that n is a "make" operation for a map type, 59 // and returns an expression that yields the *runtime._type value 60 // representing that map type. 61 func MakeMapRType(pos src.XPos, n *ir.MakeExpr) ir.Node 62 63 // MakeSliceElemRType asserts that n is a "make" operation for a slice 64 // type, and returns an expression that yields the *runtime._type 65 // value representing that slice type's element type. 66 func MakeSliceElemRType(pos src.XPos, n *ir.MakeExpr) ir.Node 67 68 // RangeMapRType asserts that n is a "range" loop over a map value, 69 // and returns an expression that yields the *runtime._type value 70 // representing that map type. 71 func RangeMapRType(pos src.XPos, n *ir.RangeStmt) ir.Node 72 73 // UnsafeSliceElemRType asserts that n is an "unsafe.Slice" operation, 74 // and returns an expression that yields the *runtime._type value 75 // representing the result slice type's element type. 76 func UnsafeSliceElemRType(pos src.XPos, n *ir.BinaryExpr) ir.Node