diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-01-23 15:02:47 +0100 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-01-23 18:13:06 +0100 |
| commit | b323c5aaa9b926ba43a9c5435b62b4fce992ff94 (patch) | |
| tree | 2620c3928f0b1b27f401565eb3d162dd2f254b11 /prog/encoding.go | |
| parent | cd23722cf2dabd28d83fa321c3cbf50a956d3fb7 (diff) | |
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.
Diffstat (limited to 'prog/encoding.go')
| -rw-r--r-- | prog/encoding.go | 4 |
1 files changed, 2 insertions, 2 deletions
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 } |
