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

Delta Between Two Patch Sets: src/pkg/reflect/type.go

Issue 6498078: code review 6498078: reflect: add Select (Closed)
Left Patch Set: diff -r df382f6986cf https://code.google.com/p/go/ Created 11 years, 6 months ago
Right Patch Set: diff -r 6cfab3a0935e https://go.googlecode.com/hg/ Created 11 years, 6 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/reflect/all_test.go ('k') | src/pkg/reflect/value.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 implements run-time reflection, allowing a program to 5 // Package reflect implements run-time reflection, allowing a program to
6 // manipulate objects with arbitrary types. The typical use is to take a value 6 // manipulate objects with arbitrary types. The typical use is to take a value
7 // with static type interface{} and extract its dynamic type information by 7 // with static type interface{} and extract its dynamic type information by
8 // calling TypeOf, which returns a Type. 8 // calling TypeOf, which returns a Type.
9 // 9 //
10 // A call to ValueOf returns a Value representing the run-time data. 10 // A call to ValueOf returns a Value representing the run-time data.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 // Out returns the type of a function type's i'th output parameter. 179 // Out returns the type of a function type's i'th output parameter.
180 // It panics if the type's Kind is not Func. 180 // It panics if the type's Kind is not Func.
181 // It panics if i is not in the range [0, NumOut()). 181 // It panics if i is not in the range [0, NumOut()).
182 Out(i int) Type 182 Out(i int) Type
183 183
184 runtimeType() *runtimeType 184 runtimeType() *runtimeType
185 common() *commonType 185 common() *commonType
186 uncommon() *uncommonType 186 uncommon() *uncommonType
187 } 187 }
188
189 /*
190 * These data structures are known to the compiler (../../cmd/gc/reflect.c).
191 * A few are known to ../runtime/type.go to convey to debuggers.
192 * They are also known to ../runtime/type.h.
193 */
188 194
189 // A Kind represents the specific kind of type that a Type represents. 195 // A Kind represents the specific kind of type that a Type represents.
190 // The zero Kind is not a valid kind. 196 // The zero Kind is not a valid kind.
191 type Kind uint 197 type Kind uint
192 198
193 const ( 199 const (
194 Invalid Kind = iota 200 Invalid Kind = iota
195 Bool 201 Bool
196 Int 202 Int
197 Int8 203 Int8
(...skipping 15 matching lines...) Expand all
213 Func 219 Func
214 Interface 220 Interface
215 Map 221 Map
216 Ptr 222 Ptr
217 Slice 223 Slice
218 String 224 String
219 Struct 225 Struct
220 UnsafePointer 226 UnsafePointer
221 ) 227 )
222 228
223 /*
224 * These data structures are known to the compiler (../../cmd/gc/reflect.c).
225 * A few are known to ../runtime/type.go to convey to debuggers.
226 */
227
228 // The compiler can only construct empty interface values at 229 // The compiler can only construct empty interface values at
229 // compile time; non-empty interface values get created 230 // compile time; non-empty interface values get created
230 // during initialization. Type is an empty interface 231 // during initialization. Type is an empty interface
231 // so that the compiler can lay out references as data. 232 // so that the compiler can lay out references as data.
232 // The underlying type is *reflect.ArrayType and so on. 233 // The underlying type is *reflect.ArrayType and so on.
233 type runtimeType interface{} 234 type runtimeType interface{}
234 235
235 // commonType is the common implementation of most values. 236 // commonType is the common implementation of most values.
236 // It is embedded in other, public struct types, but always 237 // It is embedded in other, public struct types, but always
237 // with a unique tag like `reflect:"array"` or `reflect:"ptr"` 238 // with a unique tag like `reflect:"array"` or `reflect:"ptr"`
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 if tf.name != vf.name || tf.pkgPath != vf.pkgPath || 1231 if tf.name != vf.name || tf.pkgPath != vf.pkgPath ||
1231 tf.typ != vf.typ || tf.tag != vf.tag || tf.offse t != vf.offset { 1232 tf.typ != vf.typ || tf.tag != vf.tag || tf.offse t != vf.offset {
1232 return false 1233 return false
1233 } 1234 }
1234 } 1235 }
1235 return true 1236 return true
1236 } 1237 }
1237 1238
1238 return false 1239 return false
1239 } 1240 }
LEFTRIGHT

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