|
|
|
@ -52,7 +52,7 @@ func genUnmarshalJSON(mtyp *marshalerType) Function { |
|
|
|
|
m = newMarshalMethod(mtyp, true) |
|
|
|
|
recv = m.receiver() |
|
|
|
|
input = Name(m.scope.newIdent("input")) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name() + "JSON")) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name())) |
|
|
|
|
dec = Name(m.scope.newIdent("dec")) |
|
|
|
|
json = Name(m.scope.parent.packageName("encoding/json")) |
|
|
|
|
) |
|
|
|
@ -80,7 +80,7 @@ func genMarshalJSON(mtyp *marshalerType) Function { |
|
|
|
|
var ( |
|
|
|
|
m = newMarshalMethod(mtyp, false) |
|
|
|
|
recv = m.receiver() |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name() + "JSON")) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name())) |
|
|
|
|
enc = Name(m.scope.newIdent("enc")) |
|
|
|
|
json = Name(m.scope.parent.packageName("encoding/json")) |
|
|
|
|
) |
|
|
|
@ -118,7 +118,7 @@ func genUnmarshalLikeYAML(mtyp *marshalerType, name string) Function { |
|
|
|
|
m = newMarshalMethod(mtyp, true) |
|
|
|
|
recv = m.receiver() |
|
|
|
|
unmarshal = Name(m.scope.newIdent("unmarshal")) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name() + name)) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name())) |
|
|
|
|
dec = Name(m.scope.newIdent("dec")) |
|
|
|
|
tag = strings.ToLower(name) |
|
|
|
|
) |
|
|
|
@ -152,7 +152,7 @@ func genMarshalLikeYAML(mtyp *marshalerType, name string) Function { |
|
|
|
|
var ( |
|
|
|
|
m = newMarshalMethod(mtyp, false) |
|
|
|
|
recv = m.receiver() |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name() + name)) |
|
|
|
|
intertyp = m.intermediateType(m.scope.newIdent(m.mtyp.orig.Obj().Name())) |
|
|
|
|
enc = Name(m.scope.newIdent("enc")) |
|
|
|
|
tag = strings.ToLower(name) |
|
|
|
|
) |
|
|
|
|