mirror of
https://github.com/golang/go
synced 2024-11-25 22:37:59 -07:00
bug 135
R=r OCL=23646 CL=23646
This commit is contained in:
parent
7fa5941fad
commit
4b8e030762
@ -801,6 +801,7 @@ Node* chanop(Node*, int);
|
||||
Node* arrayop(Node*, int);
|
||||
Node* ifaceop(Type*, Node*, int);
|
||||
int ifaceas(Type*, Type*);
|
||||
int ifaceas1(Type*, Type*);
|
||||
void ifacecheck(Type*, Type*, int);
|
||||
void runifacechecks(void);
|
||||
Node* convas(Node*);
|
||||
|
@ -17,6 +17,7 @@ enum
|
||||
I2I,
|
||||
I2I2,
|
||||
T2I,
|
||||
I2Isame,
|
||||
};
|
||||
|
||||
// can this code branch reach the end
|
||||
@ -500,11 +501,12 @@ loop:
|
||||
walktype(r->left, Erv);
|
||||
if(r->left == N)
|
||||
break;
|
||||
et = ifaceas(r->type, r->left->type);
|
||||
et = ifaceas1(r->type, r->left->type);
|
||||
switch(et) {
|
||||
case I2T:
|
||||
et = I2T2;
|
||||
break;
|
||||
case I2Isame:
|
||||
case I2I:
|
||||
et = I2I2;
|
||||
break;
|
||||
@ -2772,7 +2774,7 @@ arrayop(Node *n, int top)
|
||||
* return op to use.
|
||||
*/
|
||||
int
|
||||
ifaceas(Type *dst, Type *src)
|
||||
ifaceas1(Type *dst, Type *src)
|
||||
{
|
||||
if(src == T || dst == T)
|
||||
return Inone;
|
||||
@ -2780,7 +2782,7 @@ ifaceas(Type *dst, Type *src)
|
||||
if(isinter(dst)) {
|
||||
if(isinter(src)) {
|
||||
if(eqtype(dst, src, 0))
|
||||
return Inone;
|
||||
return I2Isame;
|
||||
return I2I;
|
||||
}
|
||||
if(isnilinter(dst))
|
||||
@ -2797,6 +2799,20 @@ ifaceas(Type *dst, Type *src)
|
||||
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*
|
||||
ifacename[] =
|
||||
{
|
||||
@ -2804,6 +2820,7 @@ ifacename[] =
|
||||
[I2T2] = "ifaceI2T2",
|
||||
[I2I] = "ifaceI2I",
|
||||
[I2I2] = "ifaceI2I2",
|
||||
[I2Isame] = "ifaceI2Isame",
|
||||
};
|
||||
|
||||
Node*
|
||||
|
Loading…
Reference in New Issue
Block a user