Commit 284c00e2 by Ian Lance Taylor

compiler: support alias to pointer type as receiver in method declaration

    
    Fixes golang/go#27994.
    
    Reviewed-on: https://go-review.googlesource.com/c/160459

From-SVN: r268450
parent 577d6588
2206f40fc1e0e1e2ba3eacb7388dd26b72729bde
cbcc538adc5177778da5788d1101e16f106a1514
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
......@@ -2096,12 +2096,20 @@ Gogo::declare_function(const std::string& name, Function_type* type,
// declarations.
Type* rtype = type->receiver()->type();
while (rtype->named_type() != NULL
&& rtype->named_type()->is_alias())
rtype = rtype->named_type()->real_type()->forwarded();
// We want to look through the pointer created by the
// parser, without getting an error if the type is not yet
// defined.
if (rtype->classification() == Type::TYPE_POINTER)
rtype = rtype->points_to();
while (rtype->named_type() != NULL
&& rtype->named_type()->is_alias())
rtype = rtype->named_type()->real_type()->forwarded();
if (rtype->is_error_type())
return NULL;
else if (rtype->named_type() != NULL)
......
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