builder: add comment to parse_imports `re: dup file parsing`

pull/5990/head^2
joe-conigliaro 2020-07-27 12:06:48 +10:00
parent 3d19167628
commit 1086150ab9
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
1 changed files with 11 additions and 0 deletions

View File

@ -70,6 +70,17 @@ pub fn (mut b Builder) parse_imports() {
if b.pref.is_script { if b.pref.is_script {
done_imports << 'os' done_imports << 'os'
} }
// TODO (joe): decide if this is correct solution.
// in the case of building a module, the actual module files
// are passed via cmd line, so they have already been parsed
// by this stage. note that if one files from a module was
// parsed (but not all of them), then this will cause a problem.
// we could add a list of parsed files instead, but I think
// there is a better solution all around, I will revisit this.
// NOTE: there is a very similar occurance with the way
// internal module test's work, and this was the reason there
// were issues with duplicate declarations, so we should sort
// that out in a similar way.
for file in b.parsed_files { for file in b.parsed_files {
if file.mod.name != 'main' && file.mod.name !in done_imports { if file.mod.name != 'main' && file.mod.name !in done_imports {
done_imports << file.mod.name done_imports << file.mod.name