diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 468251ae59..6843968c19 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -590,7 +590,9 @@ fn (mut p Parser) anon_fn() ast.AnonFn { return ast.AnonFn{} } p.open_scope() - p.scope.detached_from_parent = true + if p.pref.backend != .js { + p.scope.detached_from_parent = true + } // TODO generics args, _, is_variadic := p.fn_args() for arg in args {