Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(394)

Side by Side Diff: src/pkg/reflect/value.go

Issue 194053: code review 194053: runtime, type switch: eliminate package global name spa... (Closed)
Patch Set: code review 194053: runtime, type switch: eliminate package global name spa... Created 15 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/reflect/type.go ('k') | src/pkg/runtime/iface.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package reflect 5 package reflect
6 6
7 import ( 7 import (
8 "runtime" 8 "runtime"
9 "unsafe" 9 "unsafe"
10 ) 10 )
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 if t == nil || i < 0 || i >= len(t.methods) { 945 if t == nil || i < 0 || i >= len(t.methods) {
946 return nil 946 return nil
947 } 947 }
948 p := &t.methods[i] 948 p := &t.methods[i]
949 949
950 // Interface is two words: itable, data. 950 // Interface is two words: itable, data.
951 tab := *(**runtime.Itable)(v.addr) 951 tab := *(**runtime.Itable)(v.addr)
952 data := &value{Typeof((*byte)(nil)), addr(uintptr(v.addr) + ptrSize), tr ue} 952 data := &value{Typeof((*byte)(nil)), addr(uintptr(v.addr) + ptrSize), tr ue}
953 953
954 // Function pointer is at p.perm in the table. 954 // Function pointer is at p.perm in the table.
955 » fn := tab.Fn[p.perm] 955 » fn := tab.Fn[i]
956 fv := &FuncValue{value: value{toType(*p.typ), addr(&fn), true}, first: d ata, isInterface: true} 956 fv := &FuncValue{value: value{toType(*p.typ), addr(&fn), true}, first: d ata, isInterface: true}
957 return fv 957 return fv
958 } 958 }
959 959
960 /* 960 /*
961 * map 961 * map
962 */ 962 */
963 963
964 // A MapValue represents a map value. 964 // A MapValue represents a map value.
965 type MapValue struct { 965 type MapValue struct {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 panicln("newValue", typ.String()) 1280 panicln("newValue", typ.String())
1281 } 1281 }
1282 1282
1283 // MakeZero returns a zero Value for the specified Type. 1283 // MakeZero returns a zero Value for the specified Type.
1284 func MakeZero(typ Type) Value { 1284 func MakeZero(typ Type) Value {
1285 if typ == nil { 1285 if typ == nil {
1286 return nil 1286 return nil
1287 } 1287 }
1288 return newValue(typ, addr(unsafe.New(typ)), true) 1288 return newValue(typ, addr(unsafe.New(typ)), true)
1289 } 1289 }
OLDNEW
« no previous file with comments | « src/pkg/reflect/type.go ('k') | src/pkg/runtime/iface.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b