parser: add `-d print_vweb_template_expansions` to ease vweb template debugging

pull/6912/head
Delyan Angelov 2020-11-21 17:59:02 +02:00
parent 4b19a6e00d
commit fa55c247a2
1 changed files with 6 additions and 0 deletions

View File

@ -72,6 +72,12 @@ fn (mut p Parser) vweb() ast.ComptimeCall {
println('>>> compiling vweb HTML template "$path"')
}
v_code := tmpl.compile_file(path, p.cur_fn_name)
$if print_vweb_template_expansions ? {
lines := v_code.split('\n')
for i, line in lines {
println('$path:${i+1}: $line')
}
}
mut scope := &ast.Scope{
start_pos: 0
parent: p.global_scope