function verifier(mtype) {
    /* eslint-disable no-unexpected-multiline */

    var gen = util.codegen("m")
    ("if(typeof m!==\"object\"||m===null)")
        ("return%j", "object expected");

    for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {
        var field = mtype._fieldsArray[i].resolve(),
            ref   = "m" + util.safeProp(field.name);

        // map fields
        if (field.map) { gen
            ("if(%s!==undefined){", ref)
                ("if(!util.isObject(%s))", ref)
                    ("return%j", invalid(field, "object"))
                ("var k=Object.keys(%s)", ref)
                ("for(var i=0;i<k.length;++i){");
                    genVerifyKey(gen, field, "k[i]");
                    genVerifyValue(gen, field, i, ref + "[k[i]]")
                ("}")
            ("}");

        // repeated fields
        } else if (field.repeated) { gen
            ("if(%s!==undefined){", ref)
                ("if(!Array.isArray(%s))", ref)
                    ("return%j", invalid(field, "array"))
                ("for(var i=0;i<%s.length;++i){", ref);
                    genVerifyValue(gen, field, i, ref + "[i]")
                ("}")
            ("}");

        // required or present fields
        } else {
            if (!field.required) {
                if (field.resolvedType && !(field.resolvedType instanceof Enum)) gen
            ("if(%s!==undefined&&%s!==null){", ref, ref);
                else gen
            ("if(%s!==undefined){", ref);
            }
                genVerifyValue(gen, field, i, ref);
            if (!field.required) gen
            ("}");
        }
    } return gen
    ("return null");
    /* eslint-enable no-unexpected-multiline */
}
Generates a verifier specific to the specified message type.
@param {Type} mtype Message type
@returns {Codegen} Codegen instance