ci: test self compilation with -autofree

pull/4776/head
Alexander Medvednikov 2020-05-07 17:37:10 +02:00
parent d096763f62
commit be063d740b
4 changed files with 16 additions and 5 deletions

View File

@ -155,6 +155,8 @@ jobs:
../../vprod -backend x64 -o 1m 1m.v
echo "Running it..."
ls
- name: V self compilation with -autofree
run: ./v -o v2 -autofree cmd/v && ./v2 -o v3 -autofree cmd/v && ./v3 -o v4 -autofree cmd/v
# - name: SDL examples
# run: git clone --depth 1 https://github.com/vlang/sdl && cd sdl

View File

@ -33,11 +33,11 @@ pub fn (mut b Builder) gen_c(v_files []string) string {
pub fn (mut b Builder) build_c(v_files []string, out_file string) {
b.out_name_c = out_file
b.info('build_c($out_file)')
output := b.gen_c(v_files)
output2 := b.gen_c(v_files)
mut f := os.create(out_file) or {
panic(err)
}
f.writeln(output)
f.writeln(output2)
f.close()
// os.write_file(out_file, b.gen_c(v_files))
}

View File

@ -43,7 +43,14 @@ pub fn compile(command string, pref &pref.Preferences) {
if pref.is_test || pref.is_run {
b.run_compiled_executable_and_exit()
}
// v.finalize_compilation()
b.myfree()
}
// Temporary, will be done by -autofree
fn (mut b Builder) myfree() {
// for file in b.parsed_files {
// }
b.parsed_files.free()
}
fn (mut b Builder) run_compiled_executable_and_exit() {
@ -152,7 +159,7 @@ pub fn (v Builder) get_user_files() []string {
preludes_path := os.join_path(vroot, 'cmd', 'tools', 'preludes')
if v.pref.is_livemain || v.pref.is_liveshared {
user_files << os.join_path(preludes_path, 'live.v')
}
}
if v.pref.is_livemain {
user_files << os.join_path(preludes_path, 'live_main.v')
}

View File

@ -1053,7 +1053,9 @@ fn (mut g Gen) autofree_scope_vars(pos int) string {
fn (g &Gen) autofree_variable(v ast.Var) string {
sym := g.table.get_type_symbol(v.typ)
// eprintln(' > var name: ${v.name:-20s} | is_arg: ${v.is_arg.str():6} | var type: ${int(v.typ):8} | type_name: ${sym.name:-33s}')
// if v.name.contains('output2') {
eprintln(' > var name: ${v.name:-20s} | is_arg: ${v.is_arg.str():6} | var type: ${int(v.typ):8} | type_name: ${sym.name:-33s}')
// }
if sym.kind == .array {
return g.autofree_var_call('array_free', v)
}