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
This commit is contained in:
parent
577d65881e
commit
284c00e210
|
@ -1,4 +1,4 @@
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue