diff --git a/cmd/tools/vtest-fixed.v b/cmd/tools/vtest-fixed.v index 9c6468d057..815bbc7670 100644 --- a/cmd/tools/vtest-fixed.v +++ b/cmd/tools/vtest-fixed.v @@ -12,7 +12,7 @@ const ( 'vlib/v/tests/num_lit_call_method_test.v', 'vlib/v/tests/pointers_test.v', 'vlib/v/tests/type_test.v', - //'vlib/v/tests/valgrind/valgrind_test.v', // ubuntu-musl only + 'vlib/v/tests/valgrind/valgrind_test.v', // ubuntu-musl only 'vlib/v/tests/pointers_str_test.v', 'vlib/net/http/http_httpbin_test.v', // fails on ubuntu-musl, because of missing openssl 'vlib/net/http/http_test.v', // fails on ubuntu-musl, because of missing openssl diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index bd1147fa85..0d1159a144 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -964,22 +964,22 @@ fn (mut g Gen) gen_clone_assignment(val ast.Expr, right_sym table.TypeSymbol, ad } fn (mut g Gen) free_scope_vars(pos int) { + println('free_scope_vars($pos)') scope := g.file.scope.innermost(pos) for _, obj in scope.objects { match obj { ast.Var { - // println('//////') - // println(var.name) - // println(var.typ) // if var.typ == 0 { // // TODO why 0? // continue // } v := *it + println(v.name) + // println(v.typ) sym := g.table.get_type_symbol(v.typ) is_optional := v.typ.flag_is(.optional) if sym.kind == .array && !is_optional { - g.writeln('array_free($v.name); // autofreed') + g.writeln('\tarray_free($v.name); // autofreed') } if sym.kind == .string && !is_optional { // Don't free simple string literals. @@ -2084,7 +2084,7 @@ fn (mut g Gen) struct_init(struct_init ast.StructInit) { field_name := c_name(field.name) g.write('\t.$field_name = ') if field.has_default_expr { - g.expr( ast.fe2ex(field.default_expr) ) + g.expr(ast.fe2ex(field.default_expr)) } else { g.write(g.type_default(field.typ)) } diff --git a/vlib/v/gen/fn.v b/vlib/v/gen/fn.v index 5d89faf61e..fd3745ad6f 100644 --- a/vlib/v/gen/fn.v +++ b/vlib/v/gen/fn.v @@ -161,6 +161,7 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) { g.stmts(it.stmts) // //////////// if g.autofree { + // println('\n\ncalling free for fn $it.name') g.free_scope_vars(it.pos.pos - 1) } // /////////