Skip to content

Commit

Permalink
Explicitly construct local variables and push_back(move)
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed May 5, 2022
1 parent 9e23b7c commit 5319f72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 6 additions & 6 deletions include/RequestLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ struct [[nodiscard]] Operation
const peg::ast_node* operation;
std::string_view name;
std::string_view type;
ResponseType responseType {};
RequestVariableList variables {};
internal::string_view_set inputTypeNames {};
RequestInputTypeList referencedInputTypes {};
internal::string_view_set enumNames {};
RequestSchemaTypeList referencedEnums {};
ResponseType responseType;
RequestVariableList variables;
internal::string_view_set inputTypeNames;
RequestInputTypeList referencedInputTypes;
internal::string_view_set enumNames;
RequestSchemaTypeList referencedEnums;
};

using OperationList = std::vector<Operation>;
Expand Down
10 changes: 7 additions & 3 deletions src/RequestLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ void RequestLoader::findOperation()

if (!_requestOptions.operationName || name == *_requestOptions.operationName)
{
_operations.emplace_back(&operationDefinition, name, operationType);
Operation operation { &operationDefinition, name, operationType };

_operations.push_back(std::move(operation));

if (_requestOptions.operationName)
{
Expand Down Expand Up @@ -781,8 +783,10 @@ void RequestLoader::findOperation()
message << " name: " << operation.name;
}

errors.emplace_back(message.str(),
service::schema_location { position.line, position.column });
service::schema_error error { message.str(),
service::schema_location { position.line, position.column } };

errors.push_back(std::move(error));

continue;
}
Expand Down

0 comments on commit 5319f72

Please sign in to comment.