mirror of
https://github.com/golang/go
synced 2024-07-08 12:18:55 +00:00
reflect: add available godoc link
Change-Id: Ib199ce1a781e8e3a66d3dc8bda617e6bc30b290e Reviewed-on: https://go-review.googlesource.com/c/go/+/539578 Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
This commit is contained in:
parent
daaf1f2220
commit
e0cd90528e
|
@ -8,9 +8,9 @@ package reflect
|
|||
|
||||
import "arena"
|
||||
|
||||
// ArenaNew returns a Value representing a pointer to a new zero value for the
|
||||
// ArenaNew returns a [Value] representing a pointer to a new zero value for the
|
||||
// specified type, allocating storage for it in the provided arena. That is,
|
||||
// the returned Value's Type is PointerTo(typ).
|
||||
// the returned Value's Type is [PointerTo](typ).
|
||||
func ArenaNew(a *arena.Arena, typ Type) Value {
|
||||
return ValueOf(arena_New(a, PointerTo(typ)))
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ type makeFuncImpl struct {
|
|||
fn func([]Value) []Value
|
||||
}
|
||||
|
||||
// MakeFunc returns a new function of the given Type
|
||||
// MakeFunc returns a new function of the given [Type]
|
||||
// that wraps the function fn. When called, that new function
|
||||
// does the following:
|
||||
//
|
||||
|
@ -30,14 +30,14 @@ type makeFuncImpl struct {
|
|||
// - runs results := fn(args).
|
||||
// - returns the results as a slice of Values, one per formal result.
|
||||
//
|
||||
// The implementation fn can assume that the argument Value slice
|
||||
// The implementation fn can assume that the argument [Value] slice
|
||||
// has the number and type of arguments given by typ.
|
||||
// If typ describes a variadic function, the final Value is itself
|
||||
// a slice representing the variadic arguments, as in the
|
||||
// body of a variadic function. The result Value slice returned by fn
|
||||
// must have the number and type of results given by typ.
|
||||
//
|
||||
// The Value.Call method allows the caller to invoke a typed function
|
||||
// The [Value.Call] method allows the caller to invoke a typed function
|
||||
// in terms of Values; in contrast, MakeFunc allows the caller to implement
|
||||
// a typed function in terms of Values.
|
||||
//
|
||||
|
|
|
@ -962,7 +962,7 @@ type StructTag string
|
|||
// If there is no such key in the tag, Get returns the empty string.
|
||||
// If the tag does not have the conventional format, the value
|
||||
// returned by Get is unspecified. To determine whether a tag is
|
||||
// explicitly set to the empty string, use Lookup.
|
||||
// explicitly set to the empty string, use [StructTag.Lookup].
|
||||
func (tag StructTag) Get(key string) string {
|
||||
v, _ := tag.Lookup(key)
|
||||
return v
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
// inappropriate to the kind of type causes a run time panic.
|
||||
//
|
||||
// The zero Value represents no value.
|
||||
// Its IsValid method returns false, its Kind method returns Invalid,
|
||||
// Its [Value.IsValid] method returns false, its Kind method returns [Invalid],
|
||||
// its String method returns "<invalid Value>", and all other methods panic.
|
||||
// Most functions and methods never return an invalid value.
|
||||
// If one does, its documentation states the conditions explicitly.
|
||||
|
@ -1541,7 +1541,7 @@ func (v Value) InterfaceData() [2]uintptr {
|
|||
// a chan, func, interface, map, pointer, or slice value; if it is
|
||||
// not, IsNil panics. Note that IsNil is not always equivalent to a
|
||||
// regular comparison with nil in Go. For example, if v was created
|
||||
// by calling ValueOf with an uninitialized interface variable i,
|
||||
// by calling [ValueOf] with an uninitialized interface variable i,
|
||||
// i==nil will be true but v.IsNil will panic as v will be the zero
|
||||
// Value.
|
||||
func (v Value) IsNil() bool {
|
||||
|
@ -1566,7 +1566,7 @@ func (v Value) IsNil() bool {
|
|||
|
||||
// IsValid reports whether v represents a value.
|
||||
// It returns false if v is the zero Value.
|
||||
// If IsValid returns false, all other methods except String panic.
|
||||
// If [Value.IsValid] returns false, all other methods except String panic.
|
||||
// Most functions and methods never return an invalid Value.
|
||||
// If one does, its documentation states the conditions explicitly.
|
||||
func (v Value) IsValid() bool {
|
||||
|
@ -2503,7 +2503,7 @@ func (v Value) SetUint(x uint64) {
|
|||
}
|
||||
|
||||
// SetPointer sets the [unsafe.Pointer] value v to x.
|
||||
// It panics if v's Kind is not UnsafePointer.
|
||||
// It panics if v's Kind is not [UnsafePointer].
|
||||
func (v Value) SetPointer(x unsafe.Pointer) {
|
||||
v.mustBeAssignable()
|
||||
v.mustBe(UnsafePointer)
|
||||
|
@ -3054,7 +3054,7 @@ const (
|
|||
// then the case is ignored, and the field Send will also be ignored and may be either zero
|
||||
// or non-zero.
|
||||
//
|
||||
// If Dir is SelectRecv, the case represents a receive operation.
|
||||
// If Dir is [SelectRecv], the case represents a receive operation.
|
||||
// Normally Chan's underlying value must be a channel and Send must be a zero Value.
|
||||
// If Chan is a zero Value, then the case is ignored, but Send must still be a zero Value.
|
||||
// When a receive operation is selected, the received Value is returned by Select.
|
||||
|
@ -3281,7 +3281,7 @@ func Zero(typ Type) Value {
|
|||
var zeroVal [abi.ZeroValSize]byte
|
||||
|
||||
// New returns a Value representing a pointer to a new zero value
|
||||
// for the specified type. That is, the returned Value's Type is PointerTo(typ).
|
||||
// for the specified type. That is, the returned Value's Type is [PointerTo](typ).
|
||||
func New(typ Type) Value {
|
||||
if typ == nil {
|
||||
panic("reflect: New(nil)")
|
||||
|
|
Loading…
Reference in New Issue
Block a user