mirror of https://github.com/tinygo-org/tinygo.git
Ayke van Laethem
6 years ago
3 changed files with 219 additions and 0 deletions
@ -0,0 +1,5 @@ |
|||
package reflect |
|||
|
|||
func Swapper(slice interface{}) func(i, j int) { |
|||
panic("unimplemented: reflect.Swapper") |
|||
} |
@ -0,0 +1,70 @@ |
|||
package reflect |
|||
|
|||
// A Kind is the number that the compiler uses for this type.
|
|||
//
|
|||
// Not used directly. These types are all replaced with the number the compiler
|
|||
// uses internally for the type.
|
|||
type Kind uint16 |
|||
|
|||
// Copied from reflect/type.go
|
|||
// https://golang.org/src/reflect/type.go?s=8302:8316#L217
|
|||
const ( |
|||
Invalid Kind = iota |
|||
Bool |
|||
Int |
|||
Int8 |
|||
Int16 |
|||
Int32 |
|||
Int64 |
|||
Uint |
|||
Uint8 |
|||
Uint16 |
|||
Uint32 |
|||
Uint64 |
|||
Uintptr |
|||
Float32 |
|||
Float64 |
|||
Complex64 |
|||
Complex128 |
|||
Array |
|||
Chan |
|||
Func |
|||
Interface |
|||
Map |
|||
Ptr |
|||
Slice |
|||
String |
|||
Struct |
|||
UnsafePointer |
|||
) |
|||
|
|||
// The typecode as used in an interface{}.
|
|||
type Type uint16 |
|||
|
|||
func TypeOf(i interface{}) Type { |
|||
return ValueOf(i).typecode |
|||
} |
|||
|
|||
func (t Type) String() string { |
|||
return "T" |
|||
} |
|||
|
|||
func (t Type) Kind() Kind { |
|||
return Invalid // TODO
|
|||
} |
|||
|
|||
func (t Type) Elem() Type { |
|||
panic("unimplemented: (reflect.Type).Elem()") |
|||
} |
|||
|
|||
func (t Type) Field(i int) StructField { |
|||
panic("unimplemented: (reflect.Type).Field()") |
|||
} |
|||
|
|||
func (t Type) Bits() int { |
|||
panic("unimplemented: (reflect.Type).Bits()") |
|||
} |
|||
|
|||
type StructField struct { |
|||
Name string |
|||
} |
@ -0,0 +1,144 @@ |
|||
package reflect |
|||
|
|||
import ( |
|||
_ "unsafe" // for go:linkname
|
|||
) |
|||
|
|||
// This is the same thing as an interface{}.
|
|||
type Value struct { |
|||
typecode Type |
|||
value *uint8 |
|||
} |
|||
|
|||
func ValueOf(i interface{}) Value |
|||
|
|||
//go:linkname _ValueOf reflect.ValueOf
|
|||
func _ValueOf(i Value) Value { |
|||
return i |
|||
} |
|||
|
|||
func (v Value) Interface() interface{} |
|||
|
|||
func (v Value) Type() Type { |
|||
return v.typecode |
|||
} |
|||
|
|||
func (v Value) Kind() Kind { |
|||
return Invalid // TODO
|
|||
} |
|||
|
|||
func (v Value) IsNil() bool { |
|||
panic("unimplemented: (reflect.Value).IsNil()") |
|||
} |
|||
|
|||
func (v Value) Pointer() uintptr { |
|||
panic("unimplemented: (reflect.Value).Pointer()") |
|||
} |
|||
|
|||
func (v Value) IsValid() bool { |
|||
panic("unimplemented: (reflect.Value).IsValid()") |
|||
} |
|||
|
|||
func (v Value) CanInterface() bool { |
|||
panic("unimplemented: (reflect.Value).CanInterface()") |
|||
} |
|||
|
|||
func (v Value) CanAddr() bool { |
|||
panic("unimplemented: (reflect.Value).CanAddr()") |
|||
} |
|||
|
|||
func (v Value) Addr() Value { |
|||
panic("unimplemented: (reflect.Value).Addr()") |
|||
} |
|||
|
|||
func (v Value) Bool() bool { |
|||
panic("unimplemented: (reflect.Value).Bool()") |
|||
} |
|||
|
|||
func (v Value) Int() int64 { |
|||
panic("unimplemented: (reflect.Value).Int()") |
|||
} |
|||
|
|||
func (v Value) Uint() uint64 { |
|||
panic("unimplemented: (reflect.Value).Uint()") |
|||
} |
|||
|
|||
func (v Value) Float() float64 { |
|||
panic("unimplemented: (reflect.Value).Float()") |
|||
} |
|||
|
|||
func (v Value) Complex() complex128 { |
|||
panic("unimplemented: (reflect.Value).Complex()") |
|||
} |
|||
|
|||
func (v Value) String() string { |
|||
panic("unimplemented: (reflect.Value).String()") |
|||
} |
|||
|
|||
func (v Value) Bytes() []byte { |
|||
panic("unimplemented: (reflect.Value).Bytes()") |
|||
} |
|||
|
|||
func (v Value) Slice(i, j int) Value { |
|||
panic("unimplemented: (reflect.Value).Slice()") |
|||
} |
|||
|
|||
func (v Value) Len() int { |
|||
panic("unimplemented: (reflect.Value).Len()") |
|||
} |
|||
|
|||
func (v Value) NumField() int { |
|||
panic("unimplemented: (reflect.Value).NumField()") |
|||
} |
|||
|
|||
func (v Value) Elem() Value { |
|||
panic("unimplemented: (reflect.Value).Elem()") |
|||
} |
|||
|
|||
func (v Value) Field(i int) Value { |
|||
panic("unimplemented: (reflect.Value).Field()") |
|||
} |
|||
|
|||
func (v Value) Index(i int) Value { |
|||
panic("unimplemented: (reflect.Value).Index()") |
|||
} |
|||
|
|||
func (v Value) MapKeys() []Value { |
|||
panic("unimplemented: (reflect.Value).MapKeys()") |
|||
} |
|||
|
|||
func (v Value) MapIndex(key Value) Value { |
|||
panic("unimplemented: (reflect.Value).MapIndex()") |
|||
} |
|||
|
|||
func (v Value) Set(x Value) { |
|||
panic("unimplemented: (reflect.Value).Set()") |
|||
} |
|||
|
|||
func (v Value) SetBool(x bool) { |
|||
panic("unimplemented: (reflect.Value).SetBool()") |
|||
} |
|||
|
|||
func (v Value) SetInt(x int64) { |
|||
panic("unimplemented: (reflect.Value).SetInt()") |
|||
} |
|||
|
|||
func (v Value) SetUint(x uint64) { |
|||
panic("unimplemented: (reflect.Value).SetUint()") |
|||
} |
|||
|
|||
func (v Value) SetFloat(x float64) { |
|||
panic("unimplemented: (reflect.Value).SetFloat()") |
|||
} |
|||
|
|||
func (v Value) SetComplex(x complex128) { |
|||
panic("unimplemented: (reflect.Value).SetComplex()") |
|||
} |
|||
|
|||
func (v Value) SetString(x string) { |
|||
panic("unimplemented: (reflect.Value).SetString()") |
|||
} |
|||
|
|||
func MakeSlice(typ Type, len, cap int) Value { |
|||
panic("unimplemented: reflect.MakeSlice()") |
|||
} |
Loading…
Reference in new issue