@@ -1089,42 +1089,38 @@ void OperationDefinitionVisitor::visit(const peg::ast_node& operationDefinition)
10891089 // Filter the variable definitions down to the ones referenced in this operation
10901090 response::Value operationVariables (response::Type::Map);
10911091
1092- peg::on_first_child <peg::variable_definitions >(operationDefinition,
1093- [this , &operationVariables](const peg::ast_node& child )
1092+ peg::for_each_child <peg::variable >(operationDefinition,
1093+ [this , &operationVariables](const peg::ast_node& variable )
10941094 {
1095- peg::for_each_child<peg::variable>(child,
1096- [this , &operationVariables](const peg::ast_node& variable)
1097- {
1098- std::string variableName;
1095+ std::string variableName;
10991096
1100- peg::on_first_child<peg::variable_name>(variable,
1101- [&variableName](const peg::ast_node& name)
1102- {
1103- // Skip the $ prefix
1104- variableName = name.content ().c_str () + 1 ;
1105- });
1097+ peg::on_first_child<peg::variable_name>(variable,
1098+ [&variableName](const peg::ast_node& name)
1099+ {
1100+ // Skip the $ prefix
1101+ variableName = name.content ().c_str () + 1 ;
1102+ });
11061103
1107- auto itrVar = _params->variables .find (variableName);
1108- response::Value valueVar;
1104+ auto itrVar = _params->variables .find (variableName);
1105+ response::Value valueVar;
11091106
1110- if (itrVar != _params->variables .get <const response::MapType&>().cend ())
1111- {
1112- valueVar = response::Value (itrVar->second );
1113- }
1114- else
1107+ if (itrVar != _params->variables .get <const response::MapType&>().cend ())
1108+ {
1109+ valueVar = response::Value (itrVar->second );
1110+ }
1111+ else
1112+ {
1113+ peg::on_first_child<peg::default_value>(variable,
1114+ [this , &valueVar](const peg::ast_node& defaultValue)
11151115 {
1116- peg::on_first_child<peg::default_value>(variable,
1117- [this , &valueVar](const peg::ast_node& defaultValue)
1118- {
1119- ValueVisitor visitor (_params->variables );
1116+ ValueVisitor visitor (_params->variables );
11201117
1121- visitor.visit (*defaultValue.children .front ());
1122- valueVar = visitor.getValue ();
1123- });
1124- }
1118+ visitor.visit (*defaultValue.children .front ());
1119+ valueVar = visitor.getValue ();
1120+ });
1121+ }
11251122
1126- operationVariables.emplace_back (std::move (variableName), std::move (valueVar));
1127- });
1123+ operationVariables.emplace_back (std::move (variableName), std::move (valueVar));
11281124 });
11291125
11301126 _params->variables = std::move (operationVariables);
0 commit comments