mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
reflect: add Type.ConvertibleTo, Value.Convert (API CHANGE)
Fixes #4047. R=iant, r CC=golang-dev https://golang.org/cl/6500065
This commit is contained in:
parent
49aa74ef7f
commit
46f379cc2c
4 changed files with 814 additions and 4 deletions
16
src/pkg/reflect/export_test.go
Normal file
16
src/pkg/reflect/export_test.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2012 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package reflect
|
||||
|
||||
// MakeRO returns a copy of v with the read-only flag set.
|
||||
func MakeRO(v Value) Value {
|
||||
v.flag |= flagRO
|
||||
return v
|
||||
}
|
||||
|
||||
// IsRO reports whether v's read-only flag is set.
|
||||
func IsRO(v Value) bool {
|
||||
return v.flag&flagRO != 0
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue