reflect: add support for struct types

This commit is contained in:
Ayke van Laethem
2019-08-08 14:41:52 +02:00
committed by Ron Evans
parent 5012be337f
commit e2c8654237
9 changed files with 654 additions and 134 deletions
+11 -1
View File
@@ -50,10 +50,20 @@ type typecodeID struct {
// * named type: the underlying type
// * interface: null
// * chan/pointer/slice: the element type
// * array/func/map/struct: TODO
// * struct: GEP of structField array (to typecode field)
// * array/func/map: TODO
references *typecodeID
}
// structField is used by the compiler to pass information to the interface
// lowering pass. It is not used in the final binary.
type structField struct {
typecode *typecodeID // type of this struct field
name *uint8 // pointer to char array
tag *uint8 // pointer to char array, or nil
embedded bool
}
// Pseudo type used before interface lowering. By using a struct instead of a
// function call, this is simpler to reason about during init interpretation
// than a function call. Also, by keeping the method set around it is easier to