diff --git a/src/generator.h b/src/generator.h index 9d0b571..a3f7620 100644 --- a/src/generator.h +++ b/src/generator.h @@ -267,7 +267,7 @@ private: // as std::wostringstream are not copyable std::vector filter_tab; std::vector ezc_frame_stack_tab; - const StreamType empty_stream; + StreamType empty_stream; // temporary streams used in [if..] [for...] or [def ...] // or if output_stream is null and an ezc function should be called @@ -391,7 +391,7 @@ private: bool Call(Item::Function & item_fun, const std::wstring * fun_name, Var & result, - const StreamType & in_stream); + StreamType & in_stream); bool Call(Item::Function & item_fun, Var & result); @@ -2083,7 +2083,7 @@ bool Generator::Call( Item::Function & item_fun, const std::wstring * fun_name, Var & result, - const StreamType & in_stream) + StreamType & in_stream) { //FindHelperOld find_helper; std::vector> parameters; @@ -2124,6 +2124,7 @@ std::vector> parameters; if( fun_child.is_function ) { + empty_stream.clear(); Call(fun_child, nullptr, parameters[i], empty_stream); } else @@ -2134,6 +2135,8 @@ std::vector> parameters; } Var empty_input; // fix me for filters + empty_input.type = Var::TYPE_STREAM; + empty_input.stream = in_stream; // IMPROVEME don't copy here streams, let Var::stream be a pointer? FindHelper find_helper(*name, item_fun.fields, parameters); find_helper.result = &result; @@ -2150,6 +2153,7 @@ template bool Generator::Call(Item::Function & item_fun, Var & result) { //return Call(item_fun, nullptr, stream_temp1, true, result, empty_stream); + empty_stream.clear(); return Call(item_fun, nullptr, result, empty_stream); } @@ -2533,6 +2537,7 @@ void Generator::MakeTextF else { Var result; + empty_stream.clear(); if( Call(item.function, nullptr, result, empty_stream) ) { @@ -2666,6 +2671,7 @@ void Generator::MakeTextF else { //Call(item.function, nullptr, stream_temp1, true, result, empty_stream); + empty_stream.clear(); Call(item.function, nullptr, result, empty_stream); } @@ -2703,6 +2709,7 @@ void Generator::MakeTextD { // call function //if( Call(fun, nullptr, stream_temp_define, true, var, empty_stream) ) + empty_stream.clear(); if( Call(fun, nullptr, var, empty_stream) ) { //CopyStreamToString(stream_temp_define, var.str); @@ -2975,6 +2982,7 @@ void Generator::MakeTextR // this Call() sets last_res which is used later when we return to CallBlock() //Call(item.function, nullptr, stream_temp1, false, result, empty_stream); //ClearStream(stream_temp1); + empty_stream.clear(); Call(item.function, nullptr, result, empty_stream); } }