WIP: add a Val struct as an input/output when calling a function
This commit is contained in:
@@ -2103,7 +2103,39 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias
|
|||||||
std::wstring & field = find_helper.fields[find_helper.field_index];
|
std::wstring & field = find_helper.fields[find_helper.field_index];
|
||||||
ValWrapper * child_valwrapper = find_helper.valwrapper->find_child(field);
|
ValWrapper * child_valwrapper = find_helper.valwrapper->find_child(field);
|
||||||
|
|
||||||
if( !child_valwrapper )
|
if( child_valwrapper )
|
||||||
|
{
|
||||||
|
// evaluate fun or method in a case they have set a non_cache attr
|
||||||
|
|
||||||
|
if( child_valwrapper->has_evaluated_val )
|
||||||
|
{
|
||||||
|
if( child_valwrapper->evaluated_str )
|
||||||
|
{
|
||||||
|
find_helper.out_stream.escape_input(false);
|
||||||
|
find_helper.out_stream << *child_valwrapper->evaluated_str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the same as below
|
||||||
|
if( child_valwrapper->val.has_function() || child_valwrapper->val.has_method() )
|
||||||
|
{
|
||||||
|
if( (find_helper.field_index + 1 < find_helper.fields.size()) || !is_for_alias )
|
||||||
|
{
|
||||||
|
bool use_parameters = (find_helper.field_index + 1 == find_helper.fields.size());
|
||||||
|
|
||||||
|
if( !EvaluateFunctions(find_helper, use_parameters, *child_valwrapper) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
find_helper.set_valwrapper(child_valwrapper);
|
||||||
|
find_helper.currentval->set_output_stream(find_helper.out_stream);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
morm::Model * model = nullptr;
|
morm::Model * model = nullptr;
|
||||||
|
|
||||||
@@ -2127,6 +2159,7 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias
|
|||||||
ValWrapper valwrapper;
|
ValWrapper valwrapper;
|
||||||
valwrapper.val = model->get_ezc_val(nullptr, field.c_str()); // may it would be better to provide a pointer to get_ezc_val() method?
|
valwrapper.val = model->get_ezc_val(nullptr, field.c_str()); // may it would be better to provide a pointer to get_ezc_val() method?
|
||||||
|
|
||||||
|
// the same block as above
|
||||||
if( valwrapper.val.has_function() || valwrapper.val.has_method() )
|
if( valwrapper.val.has_function() || valwrapper.val.has_method() )
|
||||||
{
|
{
|
||||||
if( (find_helper.field_index + 1 < find_helper.fields.size()) || !is_for_alias )
|
if( (find_helper.field_index + 1 < find_helper.fields.size()) || !is_for_alias )
|
||||||
@@ -2144,26 +2177,23 @@ bool Generator::FindLastModelWrapper(FindHelper & find_helper, bool is_for_alias
|
|||||||
(!valwrapper.has_evaluated_val && valwrapper.val.has_object()) )
|
(!valwrapper.has_evaluated_val && valwrapper.val.has_object()) )
|
||||||
{
|
{
|
||||||
child_valwrapper = find_helper.valwrapper->add_child(field, valwrapper);
|
child_valwrapper = find_helper.valwrapper->add_child(field, valwrapper);
|
||||||
}
|
find_helper.set_valwrapper(child_valwrapper);
|
||||||
}
|
find_helper.currentval->set_output_stream(find_helper.out_stream);
|
||||||
}
|
|
||||||
else
|
if( child_valwrapper->has_evaluated_val && !child_valwrapper->evaluated_val.is_allowed_to_cache() )
|
||||||
{
|
{
|
||||||
if( child_valwrapper->has_evaluated_val )
|
child_valwrapper->has_evaluated_val = false;
|
||||||
{
|
|
||||||
if( child_valwrapper->evaluated_str )
|
/*
|
||||||
{
|
* but find_helper.currentval let point to the evaluated_val (it is set by set_valwrapper() method)
|
||||||
find_helper.out_stream.escape_input(false);
|
*/
|
||||||
find_helper.out_stream << *child_valwrapper->evaluated_str;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !child_valwrapper )
|
if( !child_valwrapper )
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
find_helper.set_valwrapper(child_valwrapper);
|
|
||||||
find_helper.currentval->set_output_stream(find_helper.out_stream);
|
|
||||||
|
|
||||||
find_helper.field_index += 1;
|
find_helper.field_index += 1;
|
||||||
}
|
}
|
||||||
@@ -2394,13 +2424,13 @@ bool Generator::CallValue(FindHelper & find_helper)
|
|||||||
return CallDate(find_helper);
|
return CallDate(find_helper);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
if( find_helper.currentval->type == Val::TYPE_SPACE )
|
if( find_helper.currentval->type == Val::TYPE_SPACE )
|
||||||
{
|
{
|
||||||
return CallSpace(find_helper);
|
//return CallSpace(find_helper);
|
||||||
//return CallWrapper(find_helper);
|
//return CallWrapper(find_helper);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
// if( find_helper.base_obj ) // OBJECTS WILL BE REMOVED
|
// if( find_helper.base_obj ) // OBJECTS WILL BE REMOVED
|
||||||
// CallObject(*find_helper.base_obj, find_helper.method_index, parameters, result, out_stream, in_stream);
|
// CallObject(*find_helper.base_obj, find_helper.method_index, parameters, result, out_stream, in_stream);
|
||||||
//else
|
//else
|
||||||
|
Reference in New Issue
Block a user