Reject objects with duplicate keys.

This commit is contained in:
JoelKatz
2013-04-13 21:53:35 -07:00
parent b7484e9264
commit 1058df99ea

View File

@@ -505,6 +505,11 @@ Reader::readObject( Token &tokenStart )
colon,
tokenObjectEnd );
}
// Reject duplicate names
if (currentValue().isMember(name))
return addError( "Key '" + name + "' appears twice.", tokenName );
Value &value = currentValue()[ name ];
nodes_.push( &value );
bool ok = readValue();