fix: set the last boolean result when evaluating a space structure
This commit is contained in:
parent
3095d2d31f
commit
d023abce74
|
@ -1419,10 +1419,14 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallDate(
|
||||||
template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
|
template<class StreamType, bool is_pikotools_stream, bool is_autoescape_stream>
|
||||||
void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpaceObjectForLastField(std::vector<Var> & parameters, StreamType & out_stream, pt::Space * space)
|
void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpaceObjectForLastField(std::vector<Var> & parameters, StreamType & out_stream, pt::Space * space)
|
||||||
{
|
{
|
||||||
if( !IsTestingFunctionExistence() )
|
if( IsTestingFunctionExistence() )
|
||||||
|
{
|
||||||
|
last_res = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// CHECKME should we convert the last value to last_res?
|
|
||||||
DumpSpaceIfNeeded(parameters, out_stream, space);
|
DumpSpaceIfNeeded(parameters, out_stream, space);
|
||||||
|
last_res = space->object_size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1460,8 +1464,14 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpace
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// we are not in [for..], it can be for example [if...], return true if the table is not empty
|
// we are not in [for..], it can be for example [if...], return true if the table is not empty
|
||||||
// if we are in [if-def...] - then last_res is set later in MakeTextIfDef(Item & item) when Call() method returns
|
if( IsTestingFunctionExistence() )
|
||||||
last_res = !table->empty();
|
{
|
||||||
|
last_res = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last_res = !table->empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !IsTestingFunctionExistence() )
|
if( !IsTestingFunctionExistence() )
|
||||||
|
@ -1593,9 +1603,14 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallSpace
|
||||||
{
|
{
|
||||||
if( is_last_field )
|
if( is_last_field )
|
||||||
{
|
{
|
||||||
if( !IsTestingFunctionExistence() )
|
if( IsTestingFunctionExistence() )
|
||||||
|
{
|
||||||
|
last_res = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
PrintLastSpaceField(space, parameters, out_stream);
|
PrintLastSpaceField(space, parameters, out_stream);
|
||||||
|
last_res = space->to_bool();
|
||||||
}
|
}
|
||||||
|
|
||||||
field_index += 1;
|
field_index += 1;
|
||||||
|
@ -1666,6 +1681,8 @@ bool Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::CallModel
|
||||||
if( find_helper.field_index == fields.size() )
|
if( find_helper.field_index == fields.size() )
|
||||||
{
|
{
|
||||||
// all fields items are models or models containers
|
// all fields items are models or models containers
|
||||||
|
// at the moment we do not set last_res
|
||||||
|
// we don't know whether the last object has properties (fields) or not
|
||||||
if( !IsTestingFunctionExistence() )
|
if( !IsTestingFunctionExistence() )
|
||||||
{
|
{
|
||||||
DumpModelIfNeeded(model, parameters, out_stream);
|
DumpModelIfNeeded(model, parameters, out_stream);
|
||||||
|
|
Loading…
Reference in New Issue