| 1 |
// Copyright 2012 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 reflect |
| 6 |
|
| 7 |
// MakeRO returns a copy of v with the read-only flag set. |
| 8 |
func MakeRO(v Value) Value { |
| 9 |
v.flag |= flagStickyRO |
| 10 |
return v |
| 11 |
} |
| 12 |
|
| 13 |
// IsRO reports whether v's read-only flag is set. |
| 14 |
func IsRO(v Value) bool { |
| 15 |
return v.flag&flagStickyRO != 0 |
| 16 |
} |
| 17 |
|
| 18 |
var CallGC = &callGC |
| 19 |
|
| 20 |
// FuncLayout calls funcLayout and returns a subset of the results for testing. |
| 21 |
// |
| 22 |
// Bitmaps like stack, gc, inReg, and outReg are expanded such that each bit |
| 23 |
// takes up one byte, so that writing out test cases is a little clearer. |
| 24 |
// If ptrs is false, gc will be nil. |
| 25 |
func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr, stack, gc, inReg, outReg []byte, ptrs bool) { |
| 26 |
return |
| 27 |
} |
| 28 |
|
| 29 |
func TypeLinks() []string { |
| 30 |
return nil |
| 31 |
} |
| 32 |
|
| 33 |
var GCBits = gcbits |
| 34 |
|
| 35 |
// Will be provided by runtime eventually. |
| 36 |
func gcbits(interface{}) []byte { |
| 37 |
return nil |
| 38 |
} |
| 39 |
|
| 40 |
func MapBucketOf(x, y Type) Type { |
| 41 |
return nil |
| 42 |
} |
| 43 |
|
| 44 |
func CachedBucketOf(m Type) Type { |
| 45 |
return nil |
| 46 |
} |
| 47 |
|
| 48 |
type EmbedWithUnexpMeth struct{} |
| 49 |
|
| 50 |
func (EmbedWithUnexpMeth) f() {} |
| 51 |
|
| 52 |
type pinUnexpMeth interface { |
| 53 |
f() |
| 54 |
} |
| 55 |
|
| 56 |
var pinUnexpMethI = pinUnexpMeth(EmbedWithUnexpMeth{}) |
| 57 |
|
| 58 |
/* |
| 59 |
func FirstMethodNameBytes(t Type) *byte { |
| 60 |
_ = pinUnexpMethI |
| 61 |
|
| 62 |
ut := t.uncommon() |
| 63 |
if ut == nil { |
| 64 |
panic("type has no methods") |
| 65 |
} |
| 66 |
m := ut.methods()[0] |
| 67 |
mname := t.(*rtype).nameOff(m.name) |
| 68 |
if *mname.data(0, "name flag field")&(1<<2) == 0 { |
| 69 |
panic("method name does not have pkgPath *string") |
| 70 |
} |
| 71 |
return mname.bytes |
| 72 |
} |
| 73 |
*/ |
| 74 |
|
| 75 |
type OtherPkgFields struct { |
| 76 |
OtherExported int |
| 77 |
otherUnexported int |
| 78 |
} |
| 79 |
|
| 80 |
func IsExported(t Type) bool { |
| 81 |
return t.PkgPath() == "" |
| 82 |
} |
| 83 |
|
| 84 |
/* |
| 85 |
func ResolveReflectName(s string) { |
| 86 |
resolveReflectName(newName(s, "", false)) |
| 87 |
} |
| 88 |
*/ |
| 89 |
|
| 90 |
type Buffer struct { |
| 91 |
buf []byte |
| 92 |
} |
| 93 |
|
| 94 |
var MethodValueCallCodePtr = methodValueCallCodePtr |