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