Permalink
Browse files

New: Verify accepts non-null objects only, see #685

  • Loading branch information...
dcodeIO committed Feb 23, 2017
1 parent 2ddb76b commit 7f3f4600bcae6f2e4dadd5cdb055886193a539b7

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +43 Bytes (100%) dist/light/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
BIN +0 Bytes (100%) dist/minimal/protobuf.min.js.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN +124 Bytes (100%) dist/protobuf.min.js.gz
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -959,6 +959,12 @@ export abstract class ReflectionObject {
*/
comment: string;
/**
* Defining file name.
* @type {?string}
*/
filename: string;
/**
* Reference to the root namespace.
* @name ReflectionObject#root
@@ -270,7 +270,8 @@ Type.prototype.add = function add(object) {
// The root object takes care of adding distinct sister-fields to the respective extended
// type instead.
if (this.fieldsById[object.id])
// avoids calling the getter if not absolutely necessary because it's called quite frequently
if (this._fieldsById ? this._fieldsById[object.id] : this.fieldsById[object.id])
throw Error("duplicate id " + object.id + " in " + this);
if (object.parent)
@@ -118,11 +118,11 @@ function genVerifyKey(gen, field, ref) {
function verifier(mtype) {
/* eslint-disable no-unexpected-multiline */
if (/* initializes */ !mtype.fieldsArray.length)
return util.codegen()("return null");
var gen = util.codegen("m");
var gen = util.codegen("m")
("if(typeof m!==\"object\"||m===null)")
("return%j", "object expected");
for (var i = 0; i < mtype._fieldsArray.length; ++i) {
for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) {
var field = mtype._fieldsArray[i].resolve(),
ref = "m" + util.safeProp(field.name);

0 comments on commit 7f3f460

Please sign in to comment.