Browse Source

Util: Prevent unnecessary copy assignment calls

master
Riyyi 2 years ago
parent
commit
7c1f95e850
  1. 10
      src/util/json/parser.cpp

10
src/util/json/parser.cpp

@ -448,19 +448,19 @@ Value Parser::getObject()
// Add member (name:value pair) to object // Add member (name:value pair) to object
token = peek(); token = peek();
if (token.type == Token::Type::Literal) { if (token.type == Token::Type::Literal) {
object[name] = getLiteral(); object.emplace(name, getLiteral());
} }
else if (token.type == Token::Type::Number) { else if (token.type == Token::Type::Number) {
object[name] = getNumber(); object.emplace(name, getNumber());
} }
else if (token.type == Token::Type::String) { else if (token.type == Token::Type::String) {
object[name] = getString(); object.emplace(name, getString());
} }
else if (token.type == Token::Type::BracketOpen) { else if (token.type == Token::Type::BracketOpen) {
object[name] = getArray(); object.emplace(name, getArray());
} }
else if (token.type == Token::Type::BraceOpen) { else if (token.type == Token::Type::BraceOpen) {
object[name] = getObject(); object.emplace(name, getObject());
} }
else { else {
reportError(token, "expecting value, not '" + token.symbol + "'"); reportError(token, "expecting value, not '" + token.symbol + "'");

Loading…
Cancel
Save