reflect: add reflect.TypeOf

This is the beginning of true reflection support in TinyGo.
This commit is contained in:
Ayke van Laethem
2018-12-12 11:52:47 +01:00
parent 70f1064f36
commit f0904779a5
4 changed files with 23 additions and 8 deletions
+12
View File
@@ -0,0 +1,12 @@
package main
import "reflect"
type myint int
func main() {
println("matching types")
println(reflect.TypeOf(int(3)) == reflect.TypeOf(int(5)))
println(reflect.TypeOf(int(3)) == reflect.TypeOf(uint(5)))
println(reflect.TypeOf(myint(3)) == reflect.TypeOf(int(5)))
}
+4
View File
@@ -0,0 +1,4 @@
matching types
true
false
false