From fa55c247a29a08d612b39fbc1c6e0fb196aec58f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sat, 21 Nov 2020 17:59:02 +0200 Subject: [PATCH] parser: add `-d print_vweb_template_expansions` to ease vweb template debugging --- vlib/v/parser/comptime.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/v/parser/comptime.v b/vlib/v/parser/comptime.v index 9e31c708c2..ed4a47713a 100644 --- a/vlib/v/parser/comptime.v +++ b/vlib/v/parser/comptime.v @@ -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