diff --git a/src/generator.h b/src/generator.h index d8d626d..9aa446f 100644 --- a/src/generator.h +++ b/src/generator.h @@ -1881,6 +1881,9 @@ void Generator::EvaluateV find_helper.current_var = find_helper.previous_var->find_child(name); find_helper.found = (find_helper.current_var != nullptr); was_child_found = (find_helper.current_var != nullptr); + + if( find_helper.current_var ) + *find_helper.result = *find_helper.current_var; } if( !find_helper.found && find_helper.previous_name && find_helper.previous_result && @@ -1904,22 +1907,15 @@ void Generator::EvaluateV EvaluateFunction(find_helper.current_var->user_function, find_helper); } else - if( find_helper.current_var->type == Var::TYPE_MODEL_CONTAINER_WRAPPER && find_helper.current_var->model_container_wrapper ) - { - if( find_helper.is_last_field() && is_generating_for ) - { - find_helper.current_var->model_container_wrapper->increment_iterator(); - find_helper.current_var->clear_childs(); - } - } - else if( find_helper.current_var->type == Var::TYPE_SPACE_WRAPPER && find_helper.current_var->space_wrapper ) { + // move me below (where TYPE_MODEL_CONTAINER_WRAPPER is used) find_helper.found = CallSpace(*find_helper.current_var->space_wrapper, find_helper); } else if( find_helper.current_var->type == Var::TYPE_DATE && find_helper.current_var->date ) { + // move me below (where TYPE_MODEL_CONTAINER_WRAPPER is used) if( find_helper.is_last_field() ) PrintDate(*find_helper.current_var->date, find_helper); } @@ -1933,6 +1929,17 @@ void Generator::EvaluateV find_helper.result->type = Var::Type::TYPE_STREAM; } + if( find_helper.result->type == Var::TYPE_MODEL_CONTAINER_WRAPPER && find_helper.result->model_container_wrapper ) + { + if( find_helper.is_last_field() && is_generating_for ) + { + find_helper.result->model_container_wrapper->increment_iterator(); + find_helper.result->clear_childs(); + // but it only clears child in the first level, is it correct? + // childs from different vars will not be cleared + } + } + if( find_helper.previous_var && !was_child_found ) { // may only model_container_wrapper and space_wrapper here? @@ -2690,12 +2697,16 @@ void Generator::MakeTextF if( result.type == Var::Type::TYPE_MODEL_CONTAINER_WRAPPER ) { - result.model_container_wrapper->increment_iterator(); + //result.model_container_wrapper->increment_iterator(); // what about clear_childs() ? if( !result.model_container_wrapper->is_iterator_correct() ) break; } + else + { + break; + } // if( !result.to_bool() ) // break;