Add VDLIsZero, and use it in VDLWrite.

This CL adds the VDLIsZero method, which is used to check whether
the method receiver is the VDL zero value.  This is used in
codegen to make zero struct field checking both simpler and faster.

Also simplified both VDLRead and VDLWrite codegen, to make things
more consistent and easier to understand.

MultiPart: 4/5
Change-Id: Ib51afdb2212bdff36ae192d3226ff2ec1892c325
diff --git a/go/src/v.io/x/lock/lock.vdl.go b/go/src/v.io/x/lock/lock.vdl.go
index 0649e97..6e3072d 100644
--- a/go/src/v.io/x/lock/lock.vdl.go
+++ b/go/src/v.io/x/lock/lock.vdl.go
@@ -88,17 +88,8 @@
 	return nil
 }
 
-func (x *LockStatus) VDLRead(dec vdl.Decoder) error {
-	var err error
-	if err = dec.StartValue(); err != nil {
-		return err
-	}
-	tmp, err := dec.DecodeInt(32)
-	if err != nil {
-		return err
-	}
-	*x = LockStatus(tmp)
-	return dec.FinishValue()
+func (x LockStatus) VDLIsZero() (bool, error) {
+	return x == 0, nil
 }
 
 func (x LockStatus) VDLWrite(enc vdl.Encoder) error {
@@ -111,6 +102,18 @@
 	return enc.FinishValue()
 }
 
+func (x *LockStatus) VDLRead(dec vdl.Decoder) error {
+	if err := dec.StartValue(); err != nil {
+		return err
+	}
+	tmp, err := dec.DecodeInt(32)
+	if err != nil {
+		return err
+	}
+	*x = LockStatus(tmp)
+	return dec.FinishValue()
+}
+
 //////////////////////////////////////////////////
 // Const definitions