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

tmpl: fix $tmpl comptime operation only working in return statement (#11541)

This commit is contained in:
05st
2021-09-19 15:22:26 -05:00
committed by GitHub
parent 2534946ead
commit f9f4867c25
4 changed files with 38 additions and 8 deletions

View File

@@ -67,7 +67,7 @@ pub fn (mut p Parser) compile_template_file(template_file string, fn_name string
source.writeln('
import strings
// === vweb html template ===
fn vweb_tmpl_${fn_name}() {
fn vweb_tmpl_${fn_name}() string {
mut sb := strings.new_builder($lstartlength)\n
')
@@ -237,6 +237,7 @@ mut sb := strings.new_builder($lstartlength)\n
}
source.writeln(parser.tmpl_str_end)
source.writeln('_tmpl_res_$fn_name := sb.str() ')
source.writeln('return _tmpl_res_$fn_name')
source.writeln('}')
source.writeln('// === end of vweb html template ===')
result := source.str()