1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix hardcoded app param name in code generated for vweb.html (#15766)

This commit is contained in:
Carl Xiong 2022-09-16 22:27:58 +08:00 committed by GitHub
parent 7f30519544
commit 0b6924ebfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)