Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
witriew committed Jun 25, 2021
1 parent eb8268c commit 9888b65
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gen/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ func (f fieldGroupGenerator) ToWire(g Generator) error {
// return err
// }
func (<$v> *<.Name>) ToWire() (<$wire>.Value, error) {
<$fields := newVar "fields" ->
<- $i := newVar "i" ->
<$fields := newVar "fields" ->
<- $i := newVar "i" ->
<- $wVal := newVar "w" ->
var (
Expand Down
2 changes: 1 addition & 1 deletion gen/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (l *listGenerator) Reader(g Generator, spec *compile.ListSpec) (string, err
// }
//
// And returns its name.
func (l *listGenerator) Encode(g Generator, spec *compile.ListSpec) (string, error) {
func (l *listGenerator) Encoder(g Generator, spec *compile.ListSpec) (string, error) {
name := encoderFuncName(g, spec)
err := g.EnsureDeclared(
`
Expand Down
2 changes: 1 addition & 1 deletion gen/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (m *mapGenerator) Reader(g Generator, spec *compile.MapSpec) (string, error
// }
//
// And returns its name.
func (m *mapGenerator) Encode(g Generator, spec *compile.MapSpec) (string, error) {
func (m *mapGenerator) Encoder(g Generator, spec *compile.MapSpec) (string, error) {
name := encoderFuncName(g, spec)
err := g.EnsureDeclared(
`
Expand Down
1 change: 1 addition & 0 deletions gen/quick_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ func (q *quickSuite) testThriftRoundTripStreaming(t *testing.T, give, defaults t

sw := binary.BorrowStreamWriter(&buf)
require.NoError(t, sGive.Encode(sw), "failed to streaming encode %v", sGive)
binary.ReturnStreamWriter(sw)

gType := reflect.TypeOf(sGive)
if gType.Kind() == reflect.Ptr {
Expand Down
2 changes: 1 addition & 1 deletion gen/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (s *setGenerator) Reader(g Generator, spec *compile.SetSpec) (string, error
return name, wrapGenerateError(spec.ThriftName(), err)
}

func (s *setGenerator) Encode(g Generator, spec *compile.SetSpec) (string, error) {
func (s *setGenerator) Encoder(g Generator, spec *compile.SetSpec) (string, error) {
name := encoderFuncName(g, spec)
err := g.EnsureDeclared(
`
Expand Down
6 changes: 3 additions & 3 deletions gen/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ func (sg *StreamGenerator) Encode(g Generator, spec compile.TypeSpec, varName st
case *compile.BinarySpec:
return fmt.Sprintf("%s.WriteBinary(%s)", sw, varName), nil
case *compile.MapSpec:
encoder, err := sg.mapG.Encode(g, s)
encoder, err := sg.mapG.Encoder(g, s)
return fmt.Sprintf("%s(%s, %s)", encoder, varName, sw), err
case *compile.ListSpec:
encoder, err := sg.listG.Encode(g, s)
encoder, err := sg.listG.Encoder(g, s)
return fmt.Sprintf("%s(%s, %s)", encoder, varName, sw), err
case *compile.SetSpec:
encoder, err := sg.setG.Encode(g, s)
encoder, err := sg.setG.Encoder(g, s)
return fmt.Sprintf("%s(%s, %s)", encoder, varName, sw), err
default:
return fmt.Sprintf("%s.Encode(%s)", varName, sw), nil
Expand Down

0 comments on commit 9888b65

Please sign in to comment.