Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
fc1cf588
Commit
fc1cf588
authored
Jul 27, 2011
by
David Symonds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflect: doc fixes for obsolete types.
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/4802061
parent
2fc96269
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
src/pkg/reflect/all_test.go
src/pkg/reflect/all_test.go
+2
-2
src/pkg/reflect/type.go
src/pkg/reflect/type.go
+6
-6
src/pkg/unsafe/unsafe.go
src/pkg/unsafe/unsafe.go
+1
-1
No files found.
src/pkg/reflect/all_test.go
View file @
fc1cf588
...
...
@@ -1327,8 +1327,8 @@ func TestImportPath(t *testing.T) {
}
}
func
Test
DotDotDot
(
t
*
testing
.
T
)
{
// Test example from
FuncType.DotDotDot
documentation.
func
Test
Variadic
(
t
*
testing
.
T
)
{
// Test example from
Type
documentation.
var
f
func
(
x
int
,
y
...
float64
)
typ
:=
TypeOf
(
f
)
if
typ
.
NumIn
()
==
2
&&
typ
.
In
(
0
)
==
TypeOf
(
int
(
0
))
{
...
...
src/pkg/reflect/type.go
View file @
fc1cf588
...
...
@@ -114,11 +114,11 @@ type Type interface {
// is a "..." parameter. If so, t.In(t.NumIn() - 1) returns the parameter's
// implicit actual type []T.
//
// For concreteness, if t represents func(x int, y ... float), then
// For concreteness, if t represents func(x int, y ... float
64
), then
//
// t.NumIn() == 2
// t.In(0) is the reflect.Type for "int"
// t.In(1) is the reflect.Type for "[]float"
// t.In(1) is the reflect.Type for "[]float
64
"
// t.IsVariadic() == true
//
// IsVariadic panics if the type's Kind is not Func.
...
...
@@ -232,8 +232,8 @@ const (
// commonType is the common implementation of most values.
// It is embedded in other, public struct types, but always
// with a unique tag like
"uint" or "float" so that the client cannot
//
convert from, say, *UintType to *Float
Type.
// with a unique tag like
`reflect:"array"` or `reflect:"ptr"`
//
so that code cannot convert from, say, *arrayType to *ptr
Type.
type
commonType
struct
{
size
uintptr
...
...
@@ -977,8 +977,8 @@ func PtrTo(t Type) Type {
}
rt
.
i
=
(
*
runtime
.
PtrType
)(
unsafe
.
Pointer
(
&
rt
.
ptrType
))
// initialize p using *byte's
P
trType as a prototype.
// have to do assignment as
P
trType, not runtime.PtrType,
// initialize p using *byte's
p
trType as a prototype.
// have to do assignment as
p
trType, not runtime.PtrType,
// in order to write to unexported fields.
p
=
&
rt
.
ptrType
bp
:=
(
*
ptrType
)(
unsafe
.
Pointer
(
unsafe
.
Typeof
((
*
byte
)(
nil
))
.
(
*
runtime
.
PtrType
)))
...
...
src/pkg/unsafe/unsafe.go
View file @
fc1cf588
...
...
@@ -47,7 +47,7 @@ func Reflect(i interface{}) (typ interface{}, addr Pointer)
// empty interface value with contents the type and the value (not the pointer to
// the value). The typ is assumed to contain a pointer to a runtime type; the type
// information in the interface{} is ignored, so that, for example, both
// *reflect.
S
tructType and *runtime.StructType can be passed for typ.
// *reflect.
s
tructType and *runtime.StructType can be passed for typ.
func
Unreflect
(
typ
interface
{},
addr
Pointer
)
(
ret
interface
{})
// New allocates and returns a pointer to memory for a new value of the given type.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment