autofree: another lambda fix
parent
ccc0cb23ed
commit
dca3d13606
|
@ -2018,13 +2018,14 @@ fn (mut g Gen) expr(node ast.Expr) {
|
||||||
// if g.fileis('1.strings') {
|
// if g.fileis('1.strings') {
|
||||||
// println('before:' + node.autofree_pregen)
|
// 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)
|
// 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()
|
// and it'll get messed up here, since it's handled recursively in autofree_call_pregen()
|
||||||
// so just skip it
|
// so just skip it
|
||||||
g.autofree_call_pregen(node)
|
g.autofree_call_pregen(node)
|
||||||
if g.strs_to_free0.len > 0 {
|
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 = []
|
g.strs_to_free0 = []
|
||||||
// println('pos=$node.pos.pos')
|
// println('pos=$node.pos.pos')
|
||||||
|
|
|
@ -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' {
|
} else if !node.receiver_type.is_ptr() && node.left_type.is_ptr() && node.name != 'str' {
|
||||||
g.write('/*rec*/*')
|
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.
|
// The receiver expression needs to be freed, use the temp var.
|
||||||
fn_name := node.name.replace('.', '_')
|
fn_name := node.name.replace('.', '_')
|
||||||
arg_name := '_arg_expr_${fn_name}_0_$node.pos.pos'
|
arg_name := '_arg_expr_${fn_name}_0_$node.pos.pos'
|
||||||
|
|
|
@ -359,7 +359,8 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
|
||||||
} else {
|
} else {
|
||||||
// Parse URL query
|
// Parse URL query
|
||||||
if url_words.last().contains('?') {
|
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('?')
|
url_words[url_words.len - 1] = url_words.last().all_before('?')
|
||||||
for data in tmp_query {
|
for data in tmp_query {
|
||||||
if data.len == 2 {
|
if data.len == 2 {
|
||||||
|
|
Loading…
Reference in New Issue