diff --git a/emit.cc b/emit.cc index 6a08431f8..eaa183454 100644 --- a/emit.cc +++ b/emit.cc @@ -513,7 +513,6 @@ int Design::emit(struct target_t*tgt) const for (map::const_iterator scope = root_tasks_.begin() ; scope != root_tasks_.end() ; ++ scope) { scope->first->emit_scope(tgt); - scope->first->emit_defs(tgt); } // enumerate package scopes @@ -527,7 +526,6 @@ int Design::emit(struct target_t*tgt) const const NetScope*use_scope = cur->second->class_scope(); cur->second->emit_scope(tgt); tgt->class_type(use_scope, cur->second); - cur->second->emit_defs(tgt); } // enumerate root scopes @@ -554,6 +552,12 @@ int Design::emit(struct target_t*tgt) const // emit task and function definitions bool tasks_rc = true; + for (map::const_iterator scope = root_tasks_.begin() + ; scope != root_tasks_.end() ; ++ scope) + tasks_rc &= scope->first->emit_defs(tgt); + for (map::const_iterator cur = classes_.begin() + ; cur != classes_.end() ; ++cur) + tasks_rc &= cur->second->emit_defs(tgt); for (map::const_iterator scope = packages_.begin() ; scope != packages_.end() ; ++ scope ) tasks_rc &= scope->second->emit_defs(tgt);