Skip to content

Commit

Permalink
Emit a maximum of one error var when generating verifiers, fixes #786
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Jun 9, 2017
1 parent 3b848a1 commit f295979
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ function genVerifyValue(gen, field, fieldIndex, ref) {
gen
("break")
("}");
} else gen
("var e=types[%i].verify(%s);", fieldIndex, ref)
} else {
gen
((gen.hasErrorVar ? "" : "var ") + "e=types[%i].verify(%s);", fieldIndex, ref)
("if(e)")
("return%j+e", field.name + ".");
gen.hasErrorVar = true;
}
} else {
switch (field.type) {
case "int32":
Expand Down

0 comments on commit f295979

Please sign in to comment.