This commit is contained in:
Masaaki Goshima 2021-11-27 22:24:05 +09:00
parent 1e1c80168c
commit 0472aebe51
No known key found for this signature in database
GPG Key ID: 6A53785055537153
1 changed files with 4 additions and 1 deletions

View File

@ -85,6 +85,9 @@ func (c *Compiler) compile(typeptr uintptr) (*OpcodeSet, error) {
structTypeToCodes: map[uintptr]Opcodes{}, structTypeToCodes: map[uintptr]Opcodes{},
recursiveCodes: &Opcodes{}, recursiveCodes: &Opcodes{},
}, code) }, code)
if err := noescapeKeyCode.Validate(); err != nil {
return nil, err
}
escapeKeyCode := c.codeToOpcode(&compileContext{ escapeKeyCode := c.codeToOpcode(&compileContext{
typ: typ, typ: typ,
structTypeToCodes: map[uintptr]Opcodes{}, structTypeToCodes: map[uintptr]Opcodes{},
@ -405,7 +408,7 @@ func (c *Compiler) marshalJSONCode(typ *runtime.Type) (*MarshalJSONCode, error)
func (c *Compiler) marshalTextCode(typ *runtime.Type) (*MarshalTextCode, error) { func (c *Compiler) marshalTextCode(typ *runtime.Type) (*MarshalTextCode, error) {
return &MarshalTextCode{ return &MarshalTextCode{
typ: typ, typ: typ,
isAddrForMarshaler: !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType), isAddrForMarshaler: c.isPtrMarshalTextType(typ),
isNilableType: c.isNilableType(typ), isNilableType: c.isNilableType(typ),
}, nil }, nil
} }