From 0b6924ebfb2e816d8a3a29a2ff14f9717c6fa62a Mon Sep 17 00:00:00 2001 From: Carl Xiong Date: Fri, 16 Sep 2022 22:27:58 +0800 Subject: [PATCH] cgen: fix hardcoded `app` param name in code generated for vweb.html (#15766) --- vlib/v/gen/c/comptime.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/comptime.v b/vlib/v/gen/c/comptime.v index cdfa95e8d4..e231c2f481 100644 --- a/vlib/v/gen/c/comptime.v +++ b/vlib/v/gen/c/comptime.v @@ -70,7 +70,8 @@ fn (mut g Gen) comptime_call(mut node ast.ComptimeCall) { fn_name := g.fn_decl.name.replace('.', '__') + node.pos.pos.str() if is_html { // return vweb html template - g.writeln('vweb__Context_html(&app->Context, _tmpl_res_$fn_name); strings__Builder_free(&sb_$fn_name); string_free(&_tmpl_res_$fn_name);') + app_name := g.fn_decl.params[0].name + g.writeln('vweb__Context_html(&$app_name->Context, _tmpl_res_$fn_name); strings__Builder_free(&sb_$fn_name); string_free(&_tmpl_res_$fn_name);') } else { // return $tmpl string g.write(cur_line)