Просмотр исходного кода

reflect/prototype: fix build due to protoreflect.Value method change

protoreflect.Value.IsNull was inverted to become IsValid in CL 134998.
However, that CL was submitted without a rebase,
which broke the build since CL 135255 added a few more usages of IsNull.

Change-Id: I5e52fb880ffc92e9d8f6cab30848e65b2d6dcbdc
Reviewed-on: https://go-review.googlesource.com/135337
Reviewed-by: Damien Neil <dneil@google.com>
Joe Tsai 7 лет назад
Родитель
Сommit
757806cdda
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      reflect/prototype/protofile_type.go
  2. 1 1
      reflect/prototype/standalone_type.go

+ 2 - 2
reflect/prototype/protofile_type.go

@@ -213,7 +213,7 @@ func (t fieldDesc) IsPacked() bool                                    { return t
 func (t fieldDesc) IsMap() bool                                       { return isMap(t) }
 func (t fieldDesc) IsWeak() bool                                      { return t.f.IsWeak }
 func (t fieldDesc) Default() pref.Value                               { return t.f.dv.lazyInit(t, t.f.Default) }
-func (t fieldDesc) HasDefault() bool                                  { return !t.f.Default.IsNull() }
+func (t fieldDesc) HasDefault() bool                                  { return t.f.Default.IsValid() }
 func (t fieldDesc) OneofType() pref.OneofDescriptor                   { return t.f.ot.lazyInit(t, t.f.OneofName) }
 func (t fieldDesc) ExtendedType() pref.MessageDescriptor              { return nil }
 func (t fieldDesc) MessageType() pref.MessageDescriptor               { return t.f.mt.lazyInit(t, &t.f.MessageType) }
@@ -322,7 +322,7 @@ func (t extensionDesc) IsPacked() bool                                    { retu
 func (t extensionDesc) IsMap() bool                                       { return false }
 func (t extensionDesc) IsWeak() bool                                      { return false }
 func (t extensionDesc) Default() pref.Value                               { return t.x.dv.lazyInit(t, t.x.Default) }
-func (t extensionDesc) HasDefault() bool                                  { return !t.x.Default.IsNull() }
+func (t extensionDesc) HasDefault() bool                                  { return t.x.Default.IsValid() }
 func (t extensionDesc) OneofType() pref.OneofDescriptor                   { return nil }
 func (t extensionDesc) ExtendedType() pref.MessageDescriptor {
 	return t.x.xt.lazyInit(t, &t.x.ExtendedType)

+ 1 - 1
reflect/prototype/standalone_type.go

@@ -66,7 +66,7 @@ func (t standaloneExtension) IsPacked() bool
 func (t standaloneExtension) IsMap() bool                                       { return false }
 func (t standaloneExtension) IsWeak() bool                                      { return false }
 func (t standaloneExtension) Default() pref.Value                               { return t.x.dv.lazyInit(t, t.x.Default) }
-func (t standaloneExtension) HasDefault() bool                                  { return !t.x.Default.IsNull() }
+func (t standaloneExtension) HasDefault() bool                                  { return t.x.Default.IsValid() }
 func (t standaloneExtension) OneofType() pref.OneofDescriptor                   { return nil }
 func (t standaloneExtension) MessageType() pref.MessageDescriptor               { return t.x.MessageType }
 func (t standaloneExtension) EnumType() pref.EnumDescriptor                     { return t.x.EnumType }