pkg/ui: Clarify godoc comments for Concat and RConcat implementations.

This commit is contained in:
Qi Xiao 2020-12-25 17:36:41 +00:00
parent f94a0ec735
commit 15d69f98ff
2 changed files with 5 additions and 8 deletions

View File

@ -61,9 +61,7 @@ func (t Text) Index(k interface{}) (interface{}, error) {
}
}
// Concat implements Text+string, Text+Segment and Text+Text. Where "string"
// refers to strings and data types, such as float64, where it is reasonable
// to implicitly convert the type to a string.
// Concat implements Text+string, Text+float64, Text+Segment and Text+Text.
func (t Text) Concat(rhs interface{}) (interface{}, error) {
switch rhs := rhs.(type) {
case string:
@ -79,9 +77,7 @@ func (t Text) Concat(rhs interface{}) (interface{}, error) {
return nil, vals.ErrConcatNotImplemented
}
// RConcat implements string+Text. Where "string" refers to strings and data
// types, such as float64, where it is reasonable to implicitly convert the
// type to a string.
// RConcat implements string+Text and float64+Text.
func (t Text) RConcat(lhs interface{}) (interface{}, error) {
switch lhs := lhs.(type) {
case string:

View File

@ -87,7 +87,8 @@ func (s *Segment) Index(k interface{}) (v interface{}, ok bool) {
return v, v != nil
}
// Concat implements Segment+string, Segment+Segment and Segment+Text.
// Concat implements Segment+string, Segment+float64, Segment+Segment and
// Segment+Text.
func (s *Segment) Concat(v interface{}) (interface{}, error) {
switch rhs := v.(type) {
case string:
@ -109,7 +110,7 @@ func (s *Segment) Concat(v interface{}) (interface{}, error) {
return nil, vals.ErrConcatNotImplemented
}
// RConcat implements string+Segment.
// RConcat implements string+Segment and float64+Segment.
func (s *Segment) RConcat(v interface{}) (interface{}, error) {
switch lhs := v.(type) {
case string: