builder: fix false-positive import cycle warning

pull/4934/head
spaceface777 2020-05-19 13:17:03 +02:00 committed by GitHub
parent 96a8eaabc5
commit e07869af91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -95,9 +95,9 @@ pub fn (mut b Builder) parse_imports() {
pub fn (mut b Builder) resolve_deps() { pub fn (mut b Builder) resolve_deps() {
graph := b.import_graph() graph := b.import_graph()
deps_resolved := graph.resolve() deps_resolved := graph.resolve()
is_main_to_builtin := deps_resolved.nodes.len == 1 && deps_resolved.nodes[0].name == 'main' && deps_resolved.nodes[0].deps.len == 1 && deps_resolved.nodes[0].deps[0] == 'builtin' cycles := deps_resolved.display_cycles()
if !deps_resolved.acyclic && !is_main_to_builtin { if cycles.len > 1 {
eprintln('warning: import cycle detected between the following modules: \n' + deps_resolved.display_cycles()) eprintln('warning: import cycle detected between the following modules: \n' + cycles)
// TODO: error, when v itself does not have v.table -> v.ast -> v.table cycles anymore // TODO: error, when v itself does not have v.table -> v.ast -> v.table cycles anymore
return return
} }