Merge pull request #57 from orsonmmz/br942
bugfix #942: VHDL function bodies in arch declaration not supported
This commit is contained in:
commit
008affe557
|
|
@ -2297,7 +2297,7 @@ subprogram_body /* IEEE 1076-2008 P4.3 */
|
|||
} else if (tmp) {
|
||||
errormsg(@1, "Subprogram specification for %s doesn't match specification in package header.\n", prog->name().str());
|
||||
}
|
||||
prog->transfer_from(*active_scope);
|
||||
prog->transfer_from(*active_scope, ScopeBase::VARIABLES);
|
||||
prog->set_program_body($4);
|
||||
active_scope->bind_name(prog->name(), prog);
|
||||
active_sub = NULL;
|
||||
|
|
|
|||
|
|
@ -241,25 +241,31 @@ void ScopeBase::do_use_from(const ScopeBase*that)
|
|||
use_enums_ = that->use_enums_;
|
||||
}
|
||||
|
||||
void ScopeBase::transfer_from(ScopeBase&ref)
|
||||
void ScopeBase::transfer_from(ScopeBase&ref, transfer_type_t what)
|
||||
{
|
||||
std::copy(ref.new_signals_.begin(), ref.new_signals_.end(),
|
||||
insert_iterator<map<perm_string, Signal*> >(
|
||||
new_signals_, new_signals_.end())
|
||||
);
|
||||
ref.new_signals_.clear();
|
||||
if(what & SIGNALS) {
|
||||
std::copy(ref.new_signals_.begin(), ref.new_signals_.end(),
|
||||
insert_iterator<map<perm_string, Signal*> >(
|
||||
new_signals_, new_signals_.end())
|
||||
);
|
||||
ref.new_signals_.clear();
|
||||
}
|
||||
|
||||
std::copy(ref.new_variables_.begin(), ref.new_variables_.end(),
|
||||
insert_iterator<map<perm_string, Variable*> >(
|
||||
new_variables_, new_variables_.end())
|
||||
);
|
||||
ref.new_variables_.clear();
|
||||
if(what & VARIABLES) {
|
||||
std::copy(ref.new_variables_.begin(), ref.new_variables_.end(),
|
||||
insert_iterator<map<perm_string, Variable*> >(
|
||||
new_variables_, new_variables_.end())
|
||||
);
|
||||
ref.new_variables_.clear();
|
||||
}
|
||||
|
||||
std::copy(ref.new_components_.begin(), ref.new_components_.end(),
|
||||
insert_iterator<map<perm_string, ComponentBase*> >(
|
||||
new_components_, new_components_.end())
|
||||
);
|
||||
ref.new_components_.clear();
|
||||
if(what & COMPONENTS) {
|
||||
std::copy(ref.new_components_.begin(), ref.new_components_.end(),
|
||||
insert_iterator<map<perm_string, ComponentBase*> >(
|
||||
new_components_, new_components_.end())
|
||||
);
|
||||
ref.new_components_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void ActiveScope::set_package_header(Package*pkg)
|
||||
|
|
|
|||
|
|
@ -59,9 +59,11 @@ class ScopeBase {
|
|||
virtual const InterfacePort* find_param(perm_string by_name) const;
|
||||
Subprogram* find_subprogram(perm_string by_name) const;
|
||||
bool is_enum_name(perm_string name) const;
|
||||
// Moves all signals, variables and components from another scope to
|
||||
// this one. After the transfer new_* maps are emptied in the another scope.
|
||||
void transfer_from(ScopeBase&ref);
|
||||
|
||||
// Moves signals, variables and components from another scope to
|
||||
// this one. After the transfer new_* maps are cleared in the source scope.
|
||||
enum transfer_type_t { SIGNALS = 1, VARIABLES = 2, COMPONENTS = 4, ALL = 0xffff };
|
||||
void transfer_from(ScopeBase&ref, transfer_type_t what = ALL);
|
||||
|
||||
inline void bind_subprogram(perm_string name, Subprogram*obj)
|
||||
{ map<perm_string, Subprogram*>::iterator it;
|
||||
|
|
|
|||
Loading…
Reference in New Issue