autofree: free reference types with -experimental for now
							parent
							
								
									52b53f17b2
								
							
						
					
					
						commit
						7b60367512
					
				| 
						 | 
				
			
			@ -3246,7 +3246,7 @@ fn (mut g Gen) autofree_variable(v ast.Var) {
 | 
			
		|||
	}
 | 
			
		||||
	if sym.has_method('free') {
 | 
			
		||||
		g.autofree_var_call(c_name(sym.name) + '_free', v)
 | 
			
		||||
	} else if v.typ.is_ptr() && sym.name.after('.')[0].is_capital() {
 | 
			
		||||
	} else if g.pref.experimental && v.typ.is_ptr() && sym.name.after('.')[0].is_capital() {
 | 
			
		||||
		// Free user reference types
 | 
			
		||||
		g.autofree_var_call('free', v)
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ fn test_all() {
 | 
			
		|||
		//
 | 
			
		||||
		exe_filename := '$wrkdir/x'
 | 
			
		||||
		full_path_to_source_file := os.join_path(vroot, test)
 | 
			
		||||
		compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -autofree "$full_path_to_source_file"'
 | 
			
		||||
		compile_cmd := '$vexe -o $exe_filename -cg -cflags "-w" -experimental -autofree "$full_path_to_source_file"'
 | 
			
		||||
		vprintln('compile cmd: ${bold(compile_cmd)}')
 | 
			
		||||
		res := os.execute(compile_cmd)
 | 
			
		||||
		if res.exit_code != 0 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue