From b323c5aaa9b926ba43a9c5435b62b4fce992ff94 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Mon, 23 Jan 2017 15:02:47 +0100 Subject: prog: add FieldName to Type FieldName() is the name of the struct field or union option with this type. TypeName() is now always the name of the type. --- prog/encoding.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prog/encoding.go') diff --git a/prog/encoding.go b/prog/encoding.go index 8c7c1674a..274e94a2d 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -108,7 +108,7 @@ func (a *Arg) serialize(buf io.Writer, vars map[*Arg]int, varSeq *int) { } buf.Write([]byte{delims[1]}) case ArgUnion: - fmt.Fprintf(buf, "@%v=", a.OptionType.Name()) + fmt.Fprintf(buf, "@%v=", a.OptionType.FieldName()) a.Option.serialize(buf, vars, varSeq) default: panic("unknown arg kind") @@ -318,7 +318,7 @@ func parseArg(typ sys.Type, p *parser, vars map[string]*Arg) (*Arg, error) { p.Parse('=') var optType sys.Type for _, t2 := range t1.Options { - if name == t2.Name() { + if name == t2.FieldName() { optType = t2 break } -- cgit mrf-deployment