Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
4b8e0307
Commit
4b8e0307
authored
Jan 27, 2009
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug 135
R=r OCL=23646 CL=23646
parent
7fa5941f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-0
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+24
-7
No files found.
src/cmd/gc/go.h
View file @
4b8e0307
...
@@ -801,6 +801,7 @@ Node* chanop(Node*, int);
...
@@ -801,6 +801,7 @@ Node* chanop(Node*, int);
Node
*
arrayop
(
Node
*
,
int
);
Node
*
arrayop
(
Node
*
,
int
);
Node
*
ifaceop
(
Type
*
,
Node
*
,
int
);
Node
*
ifaceop
(
Type
*
,
Node
*
,
int
);
int
ifaceas
(
Type
*
,
Type
*
);
int
ifaceas
(
Type
*
,
Type
*
);
int
ifaceas1
(
Type
*
,
Type
*
);
void
ifacecheck
(
Type
*
,
Type
*
,
int
);
void
ifacecheck
(
Type
*
,
Type
*
,
int
);
void
runifacechecks
(
void
);
void
runifacechecks
(
void
);
Node
*
convas
(
Node
*
);
Node
*
convas
(
Node
*
);
...
...
src/cmd/gc/walk.c
View file @
4b8e0307
...
@@ -17,6 +17,7 @@ enum
...
@@ -17,6 +17,7 @@ enum
I2I
,
I2I
,
I2I2
,
I2I2
,
T2I
,
T2I
,
I2Isame
,
};
};
// can this code branch reach the end
// can this code branch reach the end
...
@@ -500,11 +501,12 @@ loop:
...
@@ -500,11 +501,12 @@ loop:
walktype
(
r
->
left
,
Erv
);
walktype
(
r
->
left
,
Erv
);
if
(
r
->
left
==
N
)
if
(
r
->
left
==
N
)
break
;
break
;
et
=
ifaceas
(
r
->
type
,
r
->
left
->
type
);
et
=
ifaceas
1
(
r
->
type
,
r
->
left
->
type
);
switch
(
et
)
{
switch
(
et
)
{
case
I2T
:
case
I2T
:
et
=
I2T2
;
et
=
I2T2
;
break
;
break
;
case
I2Isame
:
case
I2I
:
case
I2I
:
et
=
I2I2
;
et
=
I2I2
;
break
;
break
;
...
@@ -2772,7 +2774,7 @@ arrayop(Node *n, int top)
...
@@ -2772,7 +2774,7 @@ arrayop(Node *n, int top)
* return op to use.
* return op to use.
*/
*/
int
int
ifaceas
(
Type
*
dst
,
Type
*
src
)
ifaceas
1
(
Type
*
dst
,
Type
*
src
)
{
{
if
(
src
==
T
||
dst
==
T
)
if
(
src
==
T
||
dst
==
T
)
return
Inone
;
return
Inone
;
...
@@ -2780,7 +2782,7 @@ ifaceas(Type *dst, Type *src)
...
@@ -2780,7 +2782,7 @@ ifaceas(Type *dst, Type *src)
if
(
isinter
(
dst
))
{
if
(
isinter
(
dst
))
{
if
(
isinter
(
src
))
{
if
(
isinter
(
src
))
{
if
(
eqtype
(
dst
,
src
,
0
))
if
(
eqtype
(
dst
,
src
,
0
))
return
I
non
e
;
return
I
2Isam
e
;
return
I2I
;
return
I2I
;
}
}
if
(
isnilinter
(
dst
))
if
(
isnilinter
(
dst
))
...
@@ -2797,13 +2799,28 @@ ifaceas(Type *dst, Type *src)
...
@@ -2797,13 +2799,28 @@ ifaceas(Type *dst, Type *src)
return
Inone
;
return
Inone
;
}
}
/*
* treat convert T to T as noop
*/
int
ifaceas
(
Type
*
dst
,
Type
*
src
)
{
int
et
;
et
=
ifaceas1
(
dst
,
src
);
if
(
et
==
I2Isame
)
et
=
Inone
;
return
et
;
}
static
char
*
static
char
*
ifacename
[]
=
ifacename
[]
=
{
{
[
I2T
]
=
"ifaceI2T"
,
[
I2T
]
=
"ifaceI2T"
,
[
I2T2
]
=
"ifaceI2T2"
,
[
I2T2
]
=
"ifaceI2T2"
,
[
I2I
]
=
"ifaceI2I"
,
[
I2I
]
=
"ifaceI2I"
,
[
I2I2
]
=
"ifaceI2I2"
,
[
I2I2
]
=
"ifaceI2I2"
,
[
I2Isame
]
=
"ifaceI2Isame"
,
};
};
Node
*
Node
*
...
...
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