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
bcd6403c
Commit
bcd6403c
authored
Nov 03, 2008
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unnecessary 6g workaround
R=r DELTA=51 (0 added, 0 deleted, 51 changed) OCL=18399 CL=18402
parent
1ff61cef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
51 deletions
+51
-51
src/lib/reflect/value.go
src/lib/reflect/value.go
+51
-51
No files found.
src/lib/reflect/value.go
View file @
bcd6403c
...
@@ -21,17 +21,17 @@ export type Value interface {
...
@@ -21,17 +21,17 @@ export type Value interface {
// Common fields and functionality for all values
// Common fields and functionality for all values
type
Common
V
struct
{
// BUG: want to call this Common but 6g does not hide the name
type
Common
struct
{
kind
int
;
kind
int
;
typ
Type
;
typ
Type
;
addr
Addr
;
addr
Addr
;
}
}
func
(
c
*
Common
V
)
Kind
()
int
{
func
(
c
*
Common
)
Kind
()
int
{
return
c
.
kind
return
c
.
kind
}
}
func
(
c
*
Common
V
)
Type
()
Type
{
func
(
c
*
Common
)
Type
()
Type
{
return
c
.
typ
return
c
.
typ
}
}
...
@@ -68,11 +68,11 @@ export type MissingValue interface {
...
@@ -68,11 +68,11 @@ export type MissingValue interface {
}
}
type
MissingValueStruct
struct
{
type
MissingValueStruct
struct
{
Common
V
Common
}
}
func
MissingCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
MissingCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
MissingValueStruct
{
Common
V
{
IntKind
,
typ
,
addr
}
}
return
&
MissingValueStruct
{
Common
{
IntKind
,
typ
,
addr
}
}
}
}
// -- Int
// -- Int
...
@@ -85,11 +85,11 @@ export type IntValue interface {
...
@@ -85,11 +85,11 @@ export type IntValue interface {
}
}
type
IntValueStruct
struct
{
type
IntValueStruct
struct
{
Common
V
Common
}
}
func
IntCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
IntCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
IntValueStruct
{
Common
V
{
IntKind
,
typ
,
addr
}
}
return
&
IntValueStruct
{
Common
{
IntKind
,
typ
,
addr
}
}
}
}
func
(
v
*
IntValueStruct
)
Get
()
int
{
func
(
v
*
IntValueStruct
)
Get
()
int
{
...
@@ -110,11 +110,11 @@ export type Int8Value interface {
...
@@ -110,11 +110,11 @@ export type Int8Value interface {
}
}
type
Int8ValueStruct
struct
{
type
Int8ValueStruct
struct
{
Common
V
Common
}
}
func
Int8Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Int8Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Int8ValueStruct
{
Common
V
{
Int8Kind
,
typ
,
addr
}
}
return
&
Int8ValueStruct
{
Common
{
Int8Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Int8ValueStruct
)
Get
()
int8
{
func
(
v
*
Int8ValueStruct
)
Get
()
int8
{
...
@@ -135,11 +135,11 @@ export type Int16Value interface {
...
@@ -135,11 +135,11 @@ export type Int16Value interface {
}
}
type
Int16ValueStruct
struct
{
type
Int16ValueStruct
struct
{
Common
V
Common
}
}
func
Int16Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Int16Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Int16ValueStruct
{
Common
V
{
Int16Kind
,
typ
,
addr
}
}
return
&
Int16ValueStruct
{
Common
{
Int16Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Int16ValueStruct
)
Get
()
int16
{
func
(
v
*
Int16ValueStruct
)
Get
()
int16
{
...
@@ -160,11 +160,11 @@ export type Int32Value interface {
...
@@ -160,11 +160,11 @@ export type Int32Value interface {
}
}
type
Int32ValueStruct
struct
{
type
Int32ValueStruct
struct
{
Common
V
Common
}
}
func
Int32Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Int32Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Int32ValueStruct
{
Common
V
{
Int32Kind
,
typ
,
addr
}
}
return
&
Int32ValueStruct
{
Common
{
Int32Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Int32ValueStruct
)
Get
()
int32
{
func
(
v
*
Int32ValueStruct
)
Get
()
int32
{
...
@@ -185,11 +185,11 @@ export type Int64Value interface {
...
@@ -185,11 +185,11 @@ export type Int64Value interface {
}
}
type
Int64ValueStruct
struct
{
type
Int64ValueStruct
struct
{
Common
V
Common
}
}
func
Int64Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Int64Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Int64ValueStruct
{
Common
V
{
Int64Kind
,
typ
,
addr
}
}
return
&
Int64ValueStruct
{
Common
{
Int64Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Int64ValueStruct
)
Get
()
int64
{
func
(
v
*
Int64ValueStruct
)
Get
()
int64
{
...
@@ -210,11 +210,11 @@ export type UintValue interface {
...
@@ -210,11 +210,11 @@ export type UintValue interface {
}
}
type
UintValueStruct
struct
{
type
UintValueStruct
struct
{
Common
V
Common
}
}
func
UintCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
UintCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
UintValueStruct
{
Common
V
{
UintKind
,
typ
,
addr
}
}
return
&
UintValueStruct
{
Common
{
UintKind
,
typ
,
addr
}
}
}
}
func
(
v
*
UintValueStruct
)
Get
()
uint
{
func
(
v
*
UintValueStruct
)
Get
()
uint
{
...
@@ -235,11 +235,11 @@ export type Uint8Value interface {
...
@@ -235,11 +235,11 @@ export type Uint8Value interface {
}
}
type
Uint8ValueStruct
struct
{
type
Uint8ValueStruct
struct
{
Common
V
Common
}
}
func
Uint8Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Uint8Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Uint8ValueStruct
{
Common
V
{
Uint8Kind
,
typ
,
addr
}
}
return
&
Uint8ValueStruct
{
Common
{
Uint8Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Uint8ValueStruct
)
Get
()
uint8
{
func
(
v
*
Uint8ValueStruct
)
Get
()
uint8
{
...
@@ -260,11 +260,11 @@ export type Uint16Value interface {
...
@@ -260,11 +260,11 @@ export type Uint16Value interface {
}
}
type
Uint16ValueStruct
struct
{
type
Uint16ValueStruct
struct
{
Common
V
Common
}
}
func
Uint16Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Uint16Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Uint16ValueStruct
{
Common
V
{
Uint16Kind
,
typ
,
addr
}
}
return
&
Uint16ValueStruct
{
Common
{
Uint16Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Uint16ValueStruct
)
Get
()
uint16
{
func
(
v
*
Uint16ValueStruct
)
Get
()
uint16
{
...
@@ -285,11 +285,11 @@ export type Uint32Value interface {
...
@@ -285,11 +285,11 @@ export type Uint32Value interface {
}
}
type
Uint32ValueStruct
struct
{
type
Uint32ValueStruct
struct
{
Common
V
Common
}
}
func
Uint32Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Uint32Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Uint32ValueStruct
{
Common
V
{
Uint32Kind
,
typ
,
addr
}
}
return
&
Uint32ValueStruct
{
Common
{
Uint32Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Uint32ValueStruct
)
Get
()
uint32
{
func
(
v
*
Uint32ValueStruct
)
Get
()
uint32
{
...
@@ -310,11 +310,11 @@ export type Uint64Value interface {
...
@@ -310,11 +310,11 @@ export type Uint64Value interface {
}
}
type
Uint64ValueStruct
struct
{
type
Uint64ValueStruct
struct
{
Common
V
Common
}
}
func
Uint64Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Uint64Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Uint64ValueStruct
{
Common
V
{
Uint64Kind
,
typ
,
addr
}
}
return
&
Uint64ValueStruct
{
Common
{
Uint64Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Uint64ValueStruct
)
Get
()
uint64
{
func
(
v
*
Uint64ValueStruct
)
Get
()
uint64
{
...
@@ -335,11 +335,11 @@ export type FloatValue interface {
...
@@ -335,11 +335,11 @@ export type FloatValue interface {
}
}
type
FloatValueStruct
struct
{
type
FloatValueStruct
struct
{
Common
V
Common
}
}
func
FloatCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
FloatCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
FloatValueStruct
{
Common
V
{
FloatKind
,
typ
,
addr
}
}
return
&
FloatValueStruct
{
Common
{
FloatKind
,
typ
,
addr
}
}
}
}
func
(
v
*
FloatValueStruct
)
Get
()
float
{
func
(
v
*
FloatValueStruct
)
Get
()
float
{
...
@@ -360,11 +360,11 @@ export type Float32Value interface {
...
@@ -360,11 +360,11 @@ export type Float32Value interface {
}
}
type
Float32ValueStruct
struct
{
type
Float32ValueStruct
struct
{
Common
V
Common
}
}
func
Float32Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Float32Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Float32ValueStruct
{
Common
V
{
Float32Kind
,
typ
,
addr
}
}
return
&
Float32ValueStruct
{
Common
{
Float32Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Float32ValueStruct
)
Get
()
float32
{
func
(
v
*
Float32ValueStruct
)
Get
()
float32
{
...
@@ -385,11 +385,11 @@ export type Float64Value interface {
...
@@ -385,11 +385,11 @@ export type Float64Value interface {
}
}
type
Float64ValueStruct
struct
{
type
Float64ValueStruct
struct
{
Common
V
Common
}
}
func
Float64Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Float64Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Float64ValueStruct
{
Common
V
{
Float64Kind
,
typ
,
addr
}
}
return
&
Float64ValueStruct
{
Common
{
Float64Kind
,
typ
,
addr
}
}
}
}
func
(
v
*
Float64ValueStruct
)
Get
()
float64
{
func
(
v
*
Float64ValueStruct
)
Get
()
float64
{
...
@@ -410,11 +410,11 @@ export type Float80Value interface {
...
@@ -410,11 +410,11 @@ export type Float80Value interface {
}
}
type
Float80ValueStruct
struct
{
type
Float80ValueStruct
struct
{
Common
V
Common
}
}
func
Float80Creator
(
typ
Type
,
addr
Addr
)
Value
{
func
Float80Creator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
Float80ValueStruct
{
Common
V
{
Float80Kind
,
typ
,
addr
}
}
return
&
Float80ValueStruct
{
Common
{
Float80Kind
,
typ
,
addr
}
}
}
}
/*
/*
...
@@ -439,11 +439,11 @@ export type StringValue interface {
...
@@ -439,11 +439,11 @@ export type StringValue interface {
}
}
type
StringValueStruct
struct
{
type
StringValueStruct
struct
{
Common
V
Common
}
}
func
StringCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
StringCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
StringValueStruct
{
Common
V
{
StringKind
,
typ
,
addr
}
}
return
&
StringValueStruct
{
Common
{
StringKind
,
typ
,
addr
}
}
}
}
func
(
v
*
StringValueStruct
)
Get
()
string
{
func
(
v
*
StringValueStruct
)
Get
()
string
{
...
@@ -464,11 +464,11 @@ export type BoolValue interface {
...
@@ -464,11 +464,11 @@ export type BoolValue interface {
}
}
type
BoolValueStruct
struct
{
type
BoolValueStruct
struct
{
Common
V
Common
}
}
func
BoolCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
BoolCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
BoolValueStruct
{
Common
V
{
BoolKind
,
typ
,
addr
}
}
return
&
BoolValueStruct
{
Common
{
BoolKind
,
typ
,
addr
}
}
}
}
func
(
v
*
BoolValueStruct
)
Get
()
bool
{
func
(
v
*
BoolValueStruct
)
Get
()
bool
{
...
@@ -489,7 +489,7 @@ export type PtrValue interface {
...
@@ -489,7 +489,7 @@ export type PtrValue interface {
}
}
type
PtrValueStruct
struct
{
type
PtrValueStruct
struct
{
Common
V
Common
}
}
func
(
v
*
PtrValueStruct
)
Get
()
Addr
{
func
(
v
*
PtrValueStruct
)
Get
()
Addr
{
...
@@ -501,7 +501,7 @@ func (v *PtrValueStruct) Sub() Value {
...
@@ -501,7 +501,7 @@ func (v *PtrValueStruct) Sub() Value {
}
}
func
PtrCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
PtrCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
PtrValueStruct
{
Common
V
{
PtrKind
,
typ
,
addr
}
};
return
&
PtrValueStruct
{
Common
{
PtrKind
,
typ
,
addr
}
};
}
}
// -- Array
// -- Array
...
@@ -515,7 +515,7 @@ export type ArrayValue interface {
...
@@ -515,7 +515,7 @@ export type ArrayValue interface {
}
}
type
OpenArrayValueStruct
struct
{
type
OpenArrayValueStruct
struct
{
Common
V
;
Common
;
elemtype
Type
;
elemtype
Type
;
elemsize
uint64
;
elemsize
uint64
;
}
}
...
@@ -542,7 +542,7 @@ func (v *OpenArrayValueStruct) Elem(i uint64) Value {
...
@@ -542,7 +542,7 @@ func (v *OpenArrayValueStruct) Elem(i uint64) Value {
}
}
type
FixedArrayValueStruct
struct
{
type
FixedArrayValueStruct
struct
{
Common
V
;
Common
;
elemtype
Type
;
elemtype
Type
;
elemsize
uint64
;
elemsize
uint64
;
len
uint64
;
len
uint64
;
...
@@ -592,11 +592,11 @@ export type MapValue interface {
...
@@ -592,11 +592,11 @@ export type MapValue interface {
}
}
type
MapValueStruct
struct
{
type
MapValueStruct
struct
{
Common
V
Common
}
}
func
MapCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
MapCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
MapValueStruct
{
Common
V
{
MapKind
,
typ
,
addr
}
}
return
&
MapValueStruct
{
Common
{
MapKind
,
typ
,
addr
}
}
}
}
func
(
v
*
MapValueStruct
)
Len
()
int
{
func
(
v
*
MapValueStruct
)
Len
()
int
{
...
@@ -616,11 +616,11 @@ export type ChanValue interface {
...
@@ -616,11 +616,11 @@ export type ChanValue interface {
}
}
type
ChanValueStruct
struct
{
type
ChanValueStruct
struct
{
Common
V
Common
}
}
func
ChanCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
ChanCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
ChanValueStruct
{
Common
V
{
ChanKind
,
typ
,
addr
}
}
return
&
ChanValueStruct
{
Common
{
ChanKind
,
typ
,
addr
}
}
}
}
// -- Struct
// -- Struct
...
@@ -633,7 +633,7 @@ export type StructValue interface {
...
@@ -633,7 +633,7 @@ export type StructValue interface {
}
}
type
StructValueStruct
struct
{
type
StructValueStruct
struct
{
Common
V
;
Common
;
field
*
[]
Value
;
field
*
[]
Value
;
}
}
...
@@ -648,7 +648,7 @@ func (v *StructValueStruct) Field(i int) Value {
...
@@ -648,7 +648,7 @@ func (v *StructValueStruct) Field(i int) Value {
func
StructCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
StructCreator
(
typ
Type
,
addr
Addr
)
Value
{
t
:=
typ
.
(
StructType
);
t
:=
typ
.
(
StructType
);
nfield
:=
t
.
Len
();
nfield
:=
t
.
Len
();
v
:=
&
StructValueStruct
{
Common
V
{
StructKind
,
typ
,
addr
},
new
([]
Value
,
nfield
)
};
v
:=
&
StructValueStruct
{
Common
{
StructKind
,
typ
,
addr
},
new
([]
Value
,
nfield
)
};
for
i
:=
0
;
i
<
nfield
;
i
++
{
for
i
:=
0
;
i
<
nfield
;
i
++
{
name
,
ftype
,
str
,
offset
:=
t
.
Field
(
i
);
name
,
ftype
,
str
,
offset
:=
t
.
Field
(
i
);
v
.
field
[
i
]
=
NewValueAddr
(
ftype
,
addr
+
offset
);
v
.
field
[
i
]
=
NewValueAddr
(
ftype
,
addr
+
offset
);
...
@@ -665,11 +665,11 @@ export type InterfaceValue interface {
...
@@ -665,11 +665,11 @@ export type InterfaceValue interface {
}
}
type
InterfaceValueStruct
struct
{
type
InterfaceValueStruct
struct
{
Common
V
Common
}
}
func
InterfaceCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
InterfaceCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
InterfaceValueStruct
{
Common
V
{
InterfaceKind
,
typ
,
addr
}
}
return
&
InterfaceValueStruct
{
Common
{
InterfaceKind
,
typ
,
addr
}
}
}
}
// -- Func
// -- Func
...
@@ -680,11 +680,11 @@ export type FuncValue interface {
...
@@ -680,11 +680,11 @@ export type FuncValue interface {
}
}
type
FuncValueStruct
struct
{
type
FuncValueStruct
struct
{
Common
V
Common
}
}
func
FuncCreator
(
typ
Type
,
addr
Addr
)
Value
{
func
FuncCreator
(
typ
Type
,
addr
Addr
)
Value
{
return
&
FuncValueStruct
{
Common
V
{
FuncKind
,
typ
,
addr
}
}
return
&
FuncValueStruct
{
Common
{
FuncKind
,
typ
,
addr
}
}
}
}
var
creator
*
map
[
int
]
Creator
var
creator
*
map
[
int
]
Creator
...
...
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