mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
reflect: add reflect.TypeOf
This is the beginning of true reflection support in TinyGo.
This commit is contained in:
@@ -1,24 +1,21 @@
|
||||
package reflect
|
||||
|
||||
import (
|
||||
_ "unsafe" // for go:linkname
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// This is the same thing as an interface{}.
|
||||
type Value struct {
|
||||
typecode Type
|
||||
value *uint8
|
||||
value unsafe.Pointer
|
||||
}
|
||||
|
||||
func Indirect(v Value) Value {
|
||||
return v
|
||||
}
|
||||
|
||||
func ValueOf(i interface{}) Value
|
||||
|
||||
//go:linkname _ValueOf reflect.ValueOf
|
||||
func _ValueOf(i Value) Value {
|
||||
return i
|
||||
func ValueOf(i interface{}) Value {
|
||||
return *(*Value)(unsafe.Pointer(&i))
|
||||
}
|
||||
|
||||
func (v Value) Interface() interface{}
|
||||
|
||||
Reference in New Issue
Block a user