Commit 6137391a by Ian Lance Taylor

compiler: Fix handling of imported struct with embedded builtin type.

From-SVN: r203496
parent 713b26d0
......@@ -149,6 +149,11 @@ class Import
location() const
{ return this->location_; }
// Return the package we are importing.
Package*
package() const
{ return this->package_; }
// Return the next character.
int
peek_char()
......
......@@ -5258,6 +5258,19 @@ Struct_type::do_import(Import* imp)
}
Type* ftype = imp->read_type();
// We don't pack the names of builtin types. In
// Struct_field::is_field_name we cope with a hack. Now we
// need another hack so that we don't accidentally think
// that an embedded builtin type is accessible from another
// package (we know that all the builtin types are not
// exported).
if (name.empty() && ftype->deref()->named_type() != NULL)
{
const std::string fn(ftype->deref()->named_type()->name());
if (fn[0] >= 'a' && fn[0] <= 'z')
name = '.' + imp->package()->pkgpath() + '.' + fn;
}
Struct_field sf(Typed_identifier(name, ftype, imp->location()));
if (imp->peek_char() == ' ')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment