set *find_helper.result if a child object was found
This commit is contained in:
parent
ac66a6649d
commit
7caddeedbf
|
@ -1881,6 +1881,9 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::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<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateV
|
|||
EvaluateFunction(find_helper.current_var->user_function, find_helper);
|
||||
}
|
||||
else
|
||||
if( find_helper.current_var->type == Var<StreamType>::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<StreamType>::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<StreamType>::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<StreamType, is_pikotools_stream, is_autoescape_stream>::EvaluateV
|
|||
find_helper.result->type = Var<StreamType>::Type::TYPE_STREAM;
|
||||
}
|
||||
|
||||
if( find_helper.result->type == Var<StreamType>::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<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeTextF
|
|||
|
||||
if( result.type == Var<StreamType>::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;
|
||||
|
|
Loading…
Reference in New Issue