Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
08b4fa8a
Commit
08b4fa8a
authored
Mar 26, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't look up methods for pointer to interface.
From-SVN: r171562
parent
cb83a137
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
gcc/go/gofrontend/types.cc
+4
-5
gcc/testsuite/go.test/test/hashmap.go
+6
-6
No files found.
gcc/go/gofrontend/types.cc
View file @
08b4fa8a
...
@@ -7995,7 +7995,7 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
...
@@ -7995,7 +7995,7 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
const
Named_type
*
nt
=
type
->
deref
()
->
named_type
();
const
Named_type
*
nt
=
type
->
deref
()
->
named_type
();
const
Struct_type
*
st
=
type
->
deref
()
->
struct_type
();
const
Struct_type
*
st
=
type
->
deref
()
->
struct_type
();
const
Interface_type
*
it
=
type
->
deref
()
->
interface_type
();
const
Interface_type
*
it
=
type
->
interface_type
();
// If this is a pointer to a pointer, then it is possible that the
// If this is a pointer to a pointer, then it is possible that the
// pointed-to type has methods.
// pointed-to type has methods.
...
@@ -8011,7 +8011,6 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
...
@@ -8011,7 +8011,6 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
return
Expression
::
make_error
(
location
);
return
Expression
::
make_error
(
location
);
nt
=
type
->
points_to
()
->
named_type
();
nt
=
type
->
points_to
()
->
named_type
();
st
=
type
->
points_to
()
->
struct_type
();
st
=
type
->
points_to
()
->
struct_type
();
it
=
type
->
points_to
()
->
interface_type
();
}
}
bool
receiver_can_be_pointer
=
(
expr
->
type
()
->
points_to
()
!=
NULL
bool
receiver_can_be_pointer
=
(
expr
->
type
()
->
points_to
()
!=
NULL
...
@@ -8164,7 +8163,7 @@ Type::find_field_or_method(const Type* type,
...
@@ -8164,7 +8163,7 @@ Type::find_field_or_method(const Type* type,
}
}
// Interface types can have methods.
// Interface types can have methods.
const
Interface_type
*
it
=
type
->
deref
()
->
interface_type
();
const
Interface_type
*
it
=
type
->
interface_type
();
if
(
it
!=
NULL
&&
it
->
find_method
(
name
)
!=
NULL
)
if
(
it
!=
NULL
&&
it
->
find_method
(
name
)
!=
NULL
)
{
{
*
is_method
=
true
;
*
is_method
=
true
;
...
@@ -8326,12 +8325,12 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
...
@@ -8326,12 +8325,12 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
}
}
}
}
type
=
type
->
deref
();
const
Interface_type
*
it
=
type
->
interface_type
();
const
Interface_type
*
it
=
type
->
interface_type
();
if
(
it
!=
NULL
&&
it
->
is_unexported_method
(
gogo
,
name
))
if
(
it
!=
NULL
&&
it
->
is_unexported_method
(
gogo
,
name
))
return
true
;
return
true
;
type
=
type
->
deref
();
const
Struct_type
*
st
=
type
->
struct_type
();
const
Struct_type
*
st
=
type
->
struct_type
();
if
(
st
!=
NULL
&&
st
->
is_unexported_local_field
(
gogo
,
name
))
if
(
st
!=
NULL
&&
st
->
is_unexported_local_field
(
gogo
,
name
))
return
true
;
return
true
;
...
...
gcc/testsuite/go.test/test/hashmap.go
View file @
08b4fa8a
...
@@ -21,7 +21,7 @@ func ASSERT(p bool) {
...
@@ -21,7 +21,7 @@ func ASSERT(p bool) {
type
KeyType
interface
{
type
KeyType
interface
{
Hash
()
uint32
Hash
()
uint32
Match
(
other
*
KeyType
)
bool
Match
(
other
KeyType
)
bool
}
}
...
@@ -31,8 +31,8 @@ type ValueType interface {
...
@@ -31,8 +31,8 @@ type ValueType interface {
type
Entry
struct
{
type
Entry
struct
{
key
*
KeyType
key
KeyType
value
*
ValueType
value
ValueType
}
}
...
@@ -68,7 +68,7 @@ func (m *HashMap) Initialize (initial_log2_capacity uint32) {
...
@@ -68,7 +68,7 @@ func (m *HashMap) Initialize (initial_log2_capacity uint32) {
}
}
func
(
m
*
HashMap
)
Probe
(
key
*
KeyType
)
*
Entry
{
func
(
m
*
HashMap
)
Probe
(
key
KeyType
)
*
Entry
{
ASSERT
(
key
!=
nil
)
ASSERT
(
key
!=
nil
)
var
i
uint32
=
key
.
Hash
()
%
m
.
capacity
()
var
i
uint32
=
key
.
Hash
()
%
m
.
capacity
()
...
@@ -86,7 +86,7 @@ func (m *HashMap) Probe (key *KeyType) *Entry {
...
@@ -86,7 +86,7 @@ func (m *HashMap) Probe (key *KeyType) *Entry {
}
}
func
(
m
*
HashMap
)
Lookup
(
key
*
KeyType
,
insert
bool
)
*
Entry
{
func
(
m
*
HashMap
)
Lookup
(
key
KeyType
,
insert
bool
)
*
Entry
{
// Find a matching entry.
// Find a matching entry.
var
p
*
Entry
=
m
.
Probe
(
key
)
var
p
*
Entry
=
m
.
Probe
(
key
)
if
p
.
key
!=
nil
{
if
p
.
key
!=
nil
{
...
@@ -145,7 +145,7 @@ func (n *Number) Hash() uint32 {
...
@@ -145,7 +145,7 @@ func (n *Number) Hash() uint32 {
}
}
func
(
n
*
Number
)
Match
(
other
*
KeyType
)
bool
{
func
(
n
*
Number
)
Match
(
other
KeyType
)
bool
{
// var y *Number = other
// var y *Number = other
// return n.x == y.x
// return n.x == y.x
return
false
return
false
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment