autofree: remove old code

pull/7013/head
Alexander Medvednikov 2020-11-28 02:28:40 +01:00
parent a2fedb4285
commit c3ed8bb5da
2 changed files with 1 additions and 29 deletions

View File

@ -24,3 +24,4 @@
- fix all remaining generics issues - fix all remaining generics issues
- merge v.c and v_win.c - merge v.c and v_win.c
- more advanced errors, not just `error('message')` - more advanced errors, not just `error('message')`
- VLS for autocomplete, refactoring, go to definition etc

View File

@ -186,30 +186,6 @@ fn (mut g Gen) string_inter_literal_sb_optimized(call_expr ast.CallExpr) {
} }
fn (mut g Gen) string_inter_literal(node ast.StringInterLiteral) { fn (mut g Gen) string_inter_literal(node ast.StringInterLiteral) {
mut cur_line := ''
mut tmp := ''
free := false && !g.pref.experimental && g.pref.autofree && g.inside_call && !g.inside_return &&
g.inside_ternary == 0 && !g.inside_const
// && g.cur_fn != 0 &&
// g.cur_fn.name != ''
/*
if false && free {
// Save the string expr in a temporary variable, so that it can be removed after the call.
tmp = g.new_tmp_var()
/*
scope := g.file.scope.innermost(node.pos.pos)
scope.register(tmp, ast.Var{
name: tmp
typ: table.string_type
})
*/
// g.insert_before_stmt('// str tmp var\nstring $tmp = ')
cur_line = g.go_before_stmt(0)
g.writeln('// free _str2 $g.inside_call')
g.write('string $tmp = ')
g.strs_to_free += 'string_free(&$tmp); /*tmp str*/'
}
*/
g.write('_STR("') g.write('_STR("')
// Build the string with % // Build the string with %
mut end_string := false mut end_string := false
@ -323,9 +299,4 @@ fn (mut g Gen) string_inter_literal(node ast.StringInterLiteral) {
} }
} }
g.write(')') g.write(')')
if free {
g.writeln(';')
g.write(cur_line)
g.write(tmp)
}
} }