mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Make the reflection library match the reflection string which
6g generates for functions: expect the keyword "func". The older reflection syntax, without the "func", is still recognized for simplicity in parsing interface reflection strings. R=r,rsc DELTA=66 (31 added, 8 deleted, 27 changed) OCL=27396 CL=27422
This commit is contained in:
parent
e21d981a2f
commit
ca9765d83a
4 changed files with 56 additions and 33 deletions
|
|
@ -776,12 +776,17 @@ func interfaceCreator(typ Type, addr Addr) Value {
|
|||
// Its implementation is incomplete.
|
||||
type FuncValue interface {
|
||||
Value;
|
||||
Get() Addr; // The address of the function.
|
||||
}
|
||||
|
||||
type funcValueStruct struct {
|
||||
commonValue
|
||||
}
|
||||
|
||||
func (v *funcValueStruct) Get() Addr {
|
||||
return *(*Addr)(v.addr)
|
||||
}
|
||||
|
||||
func funcCreator(typ Type, addr Addr) Value {
|
||||
return &funcValueStruct{ commonValue{FuncKind, typ, addr} }
|
||||
}
|
||||
|
|
@ -827,8 +832,6 @@ func newValueAddr(typ Type, addr Addr) Value {
|
|||
func NewInitValue(typ Type) Value {
|
||||
// Some values cannot be made this way.
|
||||
switch typ.Kind() {
|
||||
case FuncKind: // must be pointers, at least for now (TODO?)
|
||||
return nil;
|
||||
case ArrayKind:
|
||||
if typ.(ArrayType).IsSlice() {
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue