mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-09 13:33:39 +00:00
compiler, reflect: properly handle embedded structs
This commit is contained in:
@@ -57,6 +57,7 @@ const (
|
||||
structFieldFlagAnonymous = 1 << iota
|
||||
structFieldFlagHasTag
|
||||
structFieldFlagIsExported
|
||||
structFieldFlagIsEmbedded
|
||||
)
|
||||
|
||||
// createMakeInterface emits the LLVM IR for the *ssa.MakeInterface instruction.
|
||||
@@ -243,6 +244,9 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
|
||||
if token.IsExported(field.Name()) {
|
||||
flags |= structFieldFlagIsExported
|
||||
}
|
||||
if field.Embedded() {
|
||||
flags |= structFieldFlagIsEmbedded
|
||||
}
|
||||
data := string(flags) + field.Name() + "\x00"
|
||||
if typ.Tag(i) != "" {
|
||||
if len(typ.Tag(i)) > 0xff {
|
||||
|
||||
Reference in New Issue
Block a user