Fix handling of struct members for variables imported from packages.
This commit is contained in:
parent
eba3d407ca
commit
b1d853bf9b
12
elab_expr.cc
12
elab_expr.cc
|
|
@ -2761,13 +2761,13 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
use_path.pop_back();
|
||||
|
||||
ivl_assert(*this, net == 0);
|
||||
symbol_search(this, des, scope, use_path, net, par, eve, ex1, ex2);
|
||||
symbol_search(this, des, use_scope, use_path, net, par, eve, ex1, ex2);
|
||||
|
||||
if (net == 0) {
|
||||
// Nope, no struct/class with member.
|
||||
|
||||
} else if (net->struct_type() != 0) {
|
||||
return check_for_struct_members(this, des, scope,
|
||||
return check_for_struct_members(this, des, use_scope,
|
||||
net, use_path.back().index,
|
||||
member_comp);
|
||||
|
||||
|
|
@ -3028,7 +3028,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
<< " for member " << member_comp << "." << endl;
|
||||
|
||||
ivl_assert(*this, net == 0);
|
||||
symbol_search(this, des, scope, use_path, net, par, eve, ex1, ex2);
|
||||
symbol_search(this, des, use_scope, use_path, net, par, eve, ex1, ex2);
|
||||
|
||||
// Check to see if we have a net and if so is it an
|
||||
// enumeration? If so then check to see if this is an
|
||||
|
|
@ -3044,7 +3044,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
// This expression cannot be a select!
|
||||
assert(use_path.back().index.empty());
|
||||
|
||||
return check_for_enum_methods(this, des, scope,
|
||||
return check_for_enum_methods(this, des, use_scope,
|
||||
netenum,
|
||||
use_path, member_comp.name,
|
||||
expr, expr_wid, NULL, 0);
|
||||
|
|
@ -3063,7 +3063,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
<< "got " << use_path.back().index.size() << "." << endl;
|
||||
}
|
||||
|
||||
return check_for_struct_members(this, des, scope,
|
||||
return check_for_struct_members(this, des, use_scope,
|
||||
net, use_path.back().index,
|
||||
member_comp);
|
||||
}
|
||||
|
|
@ -3075,7 +3075,7 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
<< " look for property " << member_comp << endl;
|
||||
}
|
||||
|
||||
return check_for_class_property(this, des, scope,
|
||||
return check_for_class_property(this, des, use_scope,
|
||||
net, member_comp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,9 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
|
|||
if (NetAssign_*tmp = elaborate_lval_method_class_member_(des, scope))
|
||||
return tmp;
|
||||
|
||||
/* Normally find the name in the passed scope. But if this is
|
||||
imported from a package, then located the variable from the
|
||||
package scope. */
|
||||
NetScope*use_scope = scope;
|
||||
if (package_) {
|
||||
use_scope = des->find_package(package_->pscope_name());
|
||||
|
|
@ -195,7 +198,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
|
|||
|
||||
if (reg == 0) {
|
||||
cerr << get_fileline() << ": error: Could not find variable ``"
|
||||
<< path_ << "'' in ``" << scope_path(scope) <<
|
||||
<< path_ << "'' in ``" << scope_path(use_scope) <<
|
||||
"''" << endl;
|
||||
|
||||
des->errors += 1;
|
||||
|
|
|
|||
5
pform.cc
5
pform.cc
|
|
@ -424,11 +424,8 @@ PBlock* pform_push_block_scope(char*name, PBlock::BL_TYPE bt)
|
|||
*/
|
||||
PEIdent* pform_new_ident(const pform_name_t&name)
|
||||
{
|
||||
if (name.size() != 1)
|
||||
return new PEIdent(name);
|
||||
|
||||
LexicalScope*scope = pform_peek_scope();
|
||||
map<perm_string,PPackage*>::const_iterator pkg = scope->imports.find(name.back().name);
|
||||
map<perm_string,PPackage*>::const_iterator pkg = scope->imports.find(name.front().name);
|
||||
if (pkg == scope->imports.end())
|
||||
return new PEIdent(name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue