@@ -1089,42 +1089,38 @@ void OperationDefinitionVisitor::visit(const peg::ast_node& operationDefinition)
1089
1089
// Filter the variable definitions down to the ones referenced in this operation
1090
1090
response::Value operationVariables (response::Type::Map);
1091
1091
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 )
1094
1094
{
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;
1099
1096
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
+ });
1106
1103
1107
- auto itrVar = _params->variables .find (variableName);
1108
- response::Value valueVar;
1104
+ auto itrVar = _params->variables .find (variableName);
1105
+ response::Value valueVar;
1109
1106
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)
1115
1115
{
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 );
1120
1117
1121
- visitor.visit (*defaultValue.children .front ());
1122
- valueVar = visitor.getValue ();
1123
- });
1124
- }
1118
+ visitor.visit (*defaultValue.children .front ());
1119
+ valueVar = visitor.getValue ();
1120
+ });
1121
+ }
1125
1122
1126
- operationVariables.emplace_back (std::move (variableName), std::move (valueVar));
1127
- });
1123
+ operationVariables.emplace_back (std::move (variableName), std::move (valueVar));
1128
1124
});
1129
1125
1130
1126
_params->variables = std::move (operationVariables);
0 commit comments