From ac22fe998a7a98359eb5684ad84d905ab96453e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A4schle?= Date: Fri, 1 Jan 2021 17:24:54 +0100 Subject: [PATCH] vweb: default init methods (#7779) --- vlib/v/gen/fn.v | 3 ++- vlib/vweb/vweb.v | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 38496b1ad0..f1b5c3ff6d 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -448,7 +448,8 @@ fn (mut g Gen) method_call(node ast.CallExpr) { if !is_range_slice { g.write('&') } - } else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str' { + } else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str' && + node.from_embed_type == 0 { g.write('/*rec*/*') } if node.free_receiver && !g.inside_lambda && !g.is_builtin_mod { diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 1675371d9b..79901f2e9f 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -58,6 +58,12 @@ pub mut: form_error string } +// declaring init_once in your App struct is optional +pub fn (ctx Context) init_once() {} + +// declaring init in your App struct is optional +pub fn (ctx Context) init() {} + pub struct Cookie { name string value string