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

compiler: no more mem error, so recycle import table struct

This commit is contained in:
joe-conigliaro 2019-10-04 23:12:16 +10:00 committed by Alexander Medvednikov
parent f43c4fd81c
commit 549413b48b

View File

@ -872,15 +872,10 @@ fn (table &Table) qualify_module(mod string, file_path string) string {
} }
fn (table &Table) get_file_import_table(id string) FileImportTable { fn (table &Table) get_file_import_table(id string) FileImportTable {
// if file_path.clone() in table.file_imports {
// return table.file_imports[file_path.clone()]
// }
// just get imports. memory error when recycling import table
mut fit := new_file_import_table(id)
if id in table.file_imports { if id in table.file_imports {
fit.imports = table.file_imports[id].imports return table.file_imports[id]
} }
return fit return new_file_import_table(id)
} }
fn new_file_import_table(file_path string) FileImportTable { fn new_file_import_table(file_path string) FileImportTable {