make some more optimizations when generating the output

This commit is contained in:
2024-07-08 00:34:52 +02:00
parent 6def06c647
commit 0de5623182

View File

@@ -2823,7 +2823,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeEzcFr
{ {
StreamType * old_stream = output_stream; StreamType * old_stream = output_stream;
bool old_is_output_stream_allowed = is_output_stream_allowed; bool old_is_output_stream_allowed = is_output_stream_allowed;
bool put_directly_to_one_frame = false; bool put_directly = false;
bool is_current_frame_allowed = HasAskForSuchFrame(item.function); bool is_current_frame_allowed = HasAskForSuchFrame(item.function);
if( !is_output_stream_allowed && is_current_frame_allowed ) if( !is_output_stream_allowed && is_current_frame_allowed )
@@ -2836,10 +2836,19 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeEzcFr
/* /*
* some optimization, put directly to the frame stream * some optimization, put directly to the frame stream
*/ */
put_directly_to_one_frame = true; put_directly = true;
output_stream = FindAddOutputStream(item.function.parameters[0]->name); output_stream = FindAddOutputStream(item.function.parameters[0]->name);
} }
else else
if( old_is_output_stream_allowed && !is_current_frame_allowed )
{
/*
* some optimization, put directly to the old stream
*/
put_directly = true;
// do not modify output_stream here
}
else
{ {
output_stream = GetNewStreamForFrame(); output_stream = GetNewStreamForFrame();
} }
@@ -2849,7 +2858,7 @@ void Generator<StreamType, is_pikotools_stream, is_autoescape_stream>::MakeEzcFr
if( !item.item_tab.empty() ) if( !item.item_tab.empty() )
MakeText( *item.item_tab[0] ); // should be only one item - item_container MakeText( *item.item_tab[0] ); // should be only one item - item_container
if( !put_directly_to_one_frame ) if( !put_directly )
{ {
if( old_is_output_stream_allowed ) if( old_is_output_stream_allowed )
{ {