diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 11fc651983..d20bb3b14c 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -2018,13 +2018,14 @@ fn (mut g Gen) expr(node ast.Expr) { // if g.fileis('1.strings') { // println('before:' + node.autofree_pregen) // } - if g.pref.autofree && !g.is_builtin_mod && g.strs_to_free0.len == 0 && !g.inside_lambda { // && g.inside_ternary == + if g.pref.autofree && !g.is_builtin_mod && !g.is_js_call && g.strs_to_free0.len == + 0 && !g.inside_lambda { // && g.inside_ternary == // if len != 0, that means we are handling call expr inside call expr (arg) // and it'll get messed up here, since it's handled recursively in autofree_call_pregen() // so just skip it g.autofree_call_pregen(node) if g.strs_to_free0.len > 0 { - g.insert_before_stmt(g.strs_to_free0.join('\n')) + g.insert_before_stmt(g.strs_to_free0.join('\n') + '/* inserted before */') } g.strs_to_free0 = [] // println('pos=$node.pos.pos') diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 2f31618379..139367fb8c 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -438,7 +438,7 @@ fn (mut g Gen) method_call(node ast.CallExpr) { } else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str' { g.write('/*rec*/*') } - if node.free_receiver { + if node.free_receiver && !g.inside_lambda { // The receiver expression needs to be freed, use the temp var. fn_name := node.name.replace('.', '_') arg_name := '_arg_expr_${fn_name}_0_$node.pos.pos' diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 39521da349..f4776def07 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -359,7 +359,8 @@ fn handle_conn(conn net.Socket, mut app T) { } else { // Parse URL query if url_words.last().contains('?') { - tmp_query := url_words.last().all_after('?').split('&').map(it.split('=')) + words := url_words.last().after('?').split('&') + tmp_query := words.map(it.split('=')) url_words[url_words.len - 1] = url_words.last().all_before('?') for data in tmp_query { if data.len == 2 {