rejectDupKeys

This commit is contained in:
Christopher Dunn 2015-03-06 12:35:58 -06:00
parent 527332d5d5
commit 62ad140d18

View File

@ -1432,6 +1432,11 @@ bool OurReader::readObject(Token& tokenStart) {
"Missing ':' after object member name", colon, tokenObjectEnd);
}
if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30");
if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
std::string msg = "Duplicate key: '" + name + "'";
return addErrorAndRecover(
msg, tokenName, tokenObjectEnd);
}
Value& value = currentValue()[name];
nodes_.push(&value);
bool ok = readValue();