mirror of https://github.com/goccy/go-json.git
Fix comment for #379
This commit is contained in:
parent
8459403e25
commit
88aa13e300
|
@ -487,7 +487,9 @@ func (c *Compiler) listElemCode(typ *runtime.Type) (Code, error) {
|
||||||
case typ.Kind() == reflect.Map:
|
case typ.Kind() == reflect.Map:
|
||||||
return c.ptrCode(runtime.PtrTo(typ))
|
return c.ptrCode(runtime.PtrTo(typ))
|
||||||
default:
|
default:
|
||||||
// Strictly not isPtr == true, but reflect.ValueOf().Index() is canAddr, so set isPtr == true.
|
// isPtr was originally used to indicate whether the type of top level is pointer.
|
||||||
|
// However, since the slice/array element is a specification that can get the pointer address, explicitly set isPtr to true.
|
||||||
|
// See here for related issues: https://github.com/goccy/go-json/issues/370
|
||||||
code, err := c.typeToCodeWithPtr(typ, true)
|
code, err := c.typeToCodeWithPtr(typ, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue