Deal with defaults correctly when encoding

There were two problems in the generated code for encoding frames:

 1. when calculating the size of the buffer based on the values
 supplied (the first pass), the string was first assigned to the local
 `val`, and given a default value if not present; but, the field was
 again dereferenced when actually asking for the string length. So, an
 undefined value might be defaulted to the empty string, then
 Buffer.byteLength called on undefined.

 2. if it had got past that, essentially the same thing happened later
 on while writing the values into the buffer.

This change avoids 1. by using `val` instead of dereferencing the
field again, and avoids 2. by again assigning a default value (but not
doing the additional type checks, which are assumed to have been
passed).

I've changed the error messages slightly to use the word 'field'
instead of 'argument', since the latter implies that it was a function
argument (perhaps of some higher-level API).