diff --git a/elab_expr.cc b/elab_expr.cc index 6494262a6..7338e950f 100644 --- a/elab_expr.cc +++ b/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); } } diff --git a/elab_lval.cc b/elab_lval.cc index f5d60b7aa..5244f4cd7 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -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; diff --git a/pform.cc b/pform.cc index 17f8ca12d..223196769 100644 --- a/pform.cc +++ b/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::const_iterator pkg = scope->imports.find(name.back().name); + map::const_iterator pkg = scope->imports.find(name.front().name); if (pkg == scope->imports.end()) return new PEIdent(name);