summaryrefslogtreecommitdiff
path: root/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go')
-rw-r--r--vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
index ad7c85179..f156a29f0 100644
--- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
+++ b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go
@@ -26,7 +26,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// +build !appengine
+// +build !appengine,!js
// This file contains the implementation of the proto field accesses using package unsafe.
@@ -105,3 +105,24 @@ func structPointer_Add(p structPointer, size field) structPointer {
func structPointer_Len(p structPointer, f field) int {
return len(*(*[]interface{})(unsafe.Pointer(structPointer_GetRefStructPointer(p, f))))
}
+
+func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice {
+ return &structRefSlice{p: p, f: f, size: size}
+}
+
+// A structRefSlice represents a slice of structs (themselves submessages or groups).
+type structRefSlice struct {
+ p structPointer
+ f field
+ size uintptr
+}
+
+func (v *structRefSlice) Len() int {
+ return structPointer_Len(v.p, v.f)
+}
+
+func (v *structRefSlice) Index(i int) structPointer {
+ ss := structPointer_GetStructPointer(v.p, v.f)
+ ss1 := structPointer_GetRefStructPointer(ss, 0)
+ return structPointer_Add(ss1, field(uintptr(i)*v.size))
+}