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

pull/2229/head
joe-conigliaro 2019-10-04 23:12:16 +10:00 committed by Alexander Medvednikov
parent f43c4fd81c
commit 549413b48b
1 changed files with 2 additions and 7 deletions

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 {