1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: optimize mark_var_used() etc

This commit is contained in:
Alexander Medvednikov
2019-09-23 22:47:09 +03:00
parent 8d52d877fb
commit f27f3515ae
4 changed files with 26 additions and 19 deletions

View File

@ -241,8 +241,7 @@ fn (v mut V) compile() {
for file in v.files {
mut p := v.new_parser(file)
p.parse(.decl)
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
}
// Main pass
cgen.pass = Pass.main
@ -308,6 +307,7 @@ fn (v mut V) compile() {
for file in v.files {
mut p := v.new_parser(file)
p.parse(.main)
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
// p.g.gen_x64()
// Format all files (don't format automatically generated vlib headers)
if !v.pref.nofmt && !file.contains('/vlib/') {
@ -574,11 +574,13 @@ fn (v mut V) add_v_files_to_compile() {
for file in v.files {
mut p := v.new_parser(file)
p.parse(.imports)
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
}
// Parse user imports
for file in user_files {
mut p := v.new_parser(file)
p.parse(.imports)
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
}
// Parse lib imports
/*
@ -597,6 +599,8 @@ fn (v mut V) add_v_files_to_compile() {
for file in vfiles {
mut p := v.new_parser(file, Pass.imports)
p.parse()
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
}
}
}
@ -615,6 +619,7 @@ fn (v mut V) add_v_files_to_compile() {
for file in vfiles {
mut p := v.new_parser(file)
p.parse(.imports)
if p.pref.autofree { p.scanner.text.free() free(p.scanner) }
}
}
if v.pref.is_verbose {