Permalink
Browse files

Other: Ensured that pbjs' beautify does not break regular expressions…

… in generated verify functions
  • Loading branch information...
dcodeIO committed Jan 12, 2017
1 parent 3946e0f commit 44167db494c49d9e4b561a66ad9ce2d8ed865a21

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 +3 Bytes (100%) dist/noparse/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.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
BIN -5 Bytes (100%) dist/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 +1 Byte (100%) dist/runtime/protobuf.min.js.gz
Binary file not shown.
@@ -73,15 +73,15 @@ function genVerifyKey(gen, field, ref) {
case "sint32":
case "fixed32":
case "sfixed32": gen
("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))", ref)
("if(!/^-?(?:0|[1-9][0-9]*)$/.test(%s))", ref) // it's important not to use any literals here that might be confused with short variable names by pbjs' beautify
("return%j", invalid(field, "integer key"));
break;
case "int64":
case "uint64":
case "sint64":
case "fixed64":
case "sfixed64": gen
("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))", ref)
("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/.test(%s))", ref) // see comment above: x is ok, d is not
("return%j", invalid(field, "integer|Long key"));
break;
case "bool": gen

0 comments on commit 44167db

Please sign in to comment.