From 5814bfca0d5edf1bb90be27a89910aa9f32b6195 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 22 Feb 2023 00:38:36 +0100 Subject: [PATCH] fix: correctly initialize FunInfo<> object when calling a model field --- src/funinfo.h | 4 ++-- src/generator.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/funinfo.h b/src/funinfo.h index 6681627..d53a04c 100644 --- a/src/funinfo.h +++ b/src/funinfo.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2007-2016, Tomasz Sowa + * Copyright (c) 2007-2023, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -201,7 +201,7 @@ struct FunInfo // for other statements than [for] this is always zero size_t iter; - // + // an item from the tree const Item & item; diff --git a/src/generator.h b/src/generator.h index c41dab3..7f43c42 100644 --- a/src/generator.h +++ b/src/generator.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2007-2021, Tomasz Sowa + * Copyright (c) 2007-2023, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1652,12 +1652,14 @@ bool Generator::CallModel if( parameters.empty() ) { FunInfo info(out_stream, parameters, empty, in_stream, stack_tab[stack_index-1], *stack_tab[stack_index-1].item); + PrepareEnvStruct(info); found = model.get_raw_value(nullptr, field.c_str(), nullptr, info, str, false); last_res = info.res; } else { FunInfo info(out_stream, parameters, parameters[0].str, in_stream, stack_tab[stack_index-1], *stack_tab[stack_index-1].item); + PrepareEnvStruct(info); found = model.get_raw_value(nullptr, field.c_str(), nullptr, info, str, false); last_res = info.res; }